Configuration options#

The configuration options that you will encounter would be one of the

CMake native options#

The full list of cmake variables can be overwhelming for newcomers, however this is a great resource to find all that CMake can do. Here I will give just list the very most basic options that you typically need to get started.

Option

Effect

Notes

CMAKE_<LANG>_COMPILER

Specify <LANG> compiler

CMAKE_<LANG>_FLAGS

Append <LANG> compiler flags

Try to avoid [1]

CMAKE_INSTALL_PREFIX

Specify where to install the project

CMAKE_BUILD_TYPE

Specify what build variant to configure

Can be set to "" to disable CMake default flags

Here <LANG> is typically one of C, CXX, Fortran, and many others.

Important

There are more options related to finding/importing dependencies explained in the import section. Please read that section carefully.

Project specific options#

Consult with the actual project’s documentation for the options available. Here is just the list of options that are encouraged to be implemented by this template.

Option

Effect

Notes

<PROJECT>_TESTS

Build project’s test-suite

Dynamic default [2]

<PROJECT>_SHARED_LIBS

Build project’s libraries as shared library

Dynamic default [2]

<PROJECT>_INSTALL

Enable installing the project

Dynamic default [2]

Here <PROJECT> is the project’s option namespace, which is typically the uppercase name of the project.

Upstream project options#

CMake options are propagated to upstream dependencies that are imported if the project is imported via FetchContent (see import section for more details). You can thus control the options of these dependencies as well, e.g. you could set <PROJECT2>_TESTS=ON to test the imported <PROJECT2> as well.

This, however, does not work with installed projects.