Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Building a library that uses CGAL

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Building a library that uses CGAL


Chronological Thread 
  • From: Philipp Moeller <>
  • To: Máté Kovács <>
  • Cc:
  • Subject: Re: [cgal-discuss] Building a library that uses CGAL
  • Date: Sun, 19 Jan 2014 19:14:07 +0100
  • Organization: GeometryFactory

Máté Kovács
<>
writes:

> Hi all,
>
> I'm building a library that uses CGAL internally.
> Unfortunately, I could only find instructions on how to build stand-alone
> applications, not libraries.
> For stand-alone applications, I used cgal_create_cmake_script to generate
> the CMake environment.
> Could you please tell me (or point me to a description of) how that should
> be done when building a library?

I recommend having a look at what the macro
create_single_source_cgal_program does. In essence it just uses
add_executable and target_link_libraries. You need to do the same using
add_library and target_link_libraries.

find_package(CGAL QUIET COMPONENTS Core ) # other components, if you need
them
if(NOT CGAL_FOUND)
message(ERROR "...")
endif()

add_library(my_lib_name source1.cpp source2.cpp)

if(CGAL_AUTO_LINK_ENABLED)
target_link_libraries(my_lib_name ${CGAL_LIBRARIES}
${CGAL_3RD_PARTY_LIBRARIES})
else()
target_link_libraries(my_lib_name ${CGAL_3RD_PARTY_LIBRARIES})
endif()

Have a look at http://www.cmake.org/cmake/help/v2.8.12/cmake.html for
more information and especially how to build static libraries.



Archive powered by MHonArc 2.6.18.

Top of Page