CGAL 6.0.1 - Manual
Loading...
Searching...
No Matches
Creating a CMake Script for a Program Using CGAL

To compile a program that is not shipped with CGAL, it is recommended to also rely on a CMake-supported configuration using a CMakeLists.txt.

The Bourne-shell script cgal_create_CMakeLists.txt can be used to create such CMakeLists.txt files. This script resides in the scripts directory of CGAL (e.g. CGAL-6.0.1/scripts directory if you have downloaded a tarball). Executing cgal_create_CMakeLists.txt in an application directory creates a CMakeLists.txt containing rules to build the contained application(s). Three command line options determine details of the configuration.

-s source

If this parameter is given the script will create a single executable for 'source' linked with compilations of all other source files (*.cc, *.cp, *.cxx, *.cpp, *.CPP, *.c++, or *.C). This behaviour is usually needed for (graphical) demos.

If the parameter is not given, the script creates one executable for each given source file.

-c com1:com2:...

Lists components ("com1", "com2") of CGAL to which the executable(s) should be linked. Valid components are CGAL's libraries (i.e. "Core", "ImageIO", and "Qt6"). An example is -c Core.

-b boost1:boost2:...

Lists components ("boost1", "boost2") of Boost to which the executable(s) should be linked. Valid options are, for instance, "filesystem" or "program_options".

These options should suffice to create a CMakeLists.txt script for most directories containing programs. However, in some special cases, it might still be required to create the script manually, for instance, if some source files/executables need a different linking than other source files. The Section How to use CGAL with CMake provides more details.