\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 5.0.1 - Manual
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-5.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 "Qt5"). 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".

This options should suffice to create 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.