CMake options

// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=

// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local

// Build with -fanalyzer
ENABLE_ANALYZER:BOOL=ON

// Link with ASAN
ENABLE_ASAN:BOOL=ON

// Use CI mode for building
ENABLE_CI:BOOL=OFF

// Enable the git hash for the version
ENABLE_GIT_VERSION:BOOL=ON

// Enable the safuLog fucntions
ENABLE_LOGGING:BOOL=OFF

// Enable Environment Variable Backend Support
ENV_BACKEND:BOOL=ON

// Install the samconf demos
INSTALL_SAMCONF_DEMOS:BOOL=ON

// Install the mock library
INSTALL_SAMCONF_MOCK_LIBRARY:BOOL=ON

// Install unit test utility library
INSTALL_SAMCONF_TEST_UTILS:BOOL=ON

// Install the samconf tools
INSTALL_SAMCONF_TOOLS:BOOL=ON

// Install unit tests
INSTALL_UNIT_TESTS:BOOL=ON

// Enable Json Backend Support
JSON_BACKEND:BOOL=ON

// Path to a program.
PANDOC:FILEPATH=/usr/bin/pandoc

// Path to a program.
PLANTUML:FILEPATH=/usr/bin/plantuml

// enable all default builds
SAMCONF_BUILD_DEFAULTS:BOOL=ON

// Build the samconf demos
SAMCONF_DEMOS:BOOL=ON

// Build the mock library
SAMCONF_MOCK_LIBRARY:BOOL=ON

// Build utility library for easy unit tests
SAMCONF_TEST_UTILS:BOOL=ON

// Build samconf tools like signature.sh
SAMCONF_TOOLS:BOOL=ON

// Build unit tests
UNIT_TESTS:BOOL=ON

// The directory containing a CMake configuration file for cmocka.
cmocka_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/cmocka

// The directory containing a CMake configuration file for cmocka_extensions.
cmocka_extensions_DIR:PATH=/usr/local/lib/cmake/cmocka_extensions

// The directory containing a CMake configuration file for cmocka_mocks.
cmocka_mocks_DIR:PATH=/usr/local/lib/cmake/cmocka_mocks

// The directory containing a CMake configuration file for json-c.
json-c_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/json-c

// The directory containing a CMake configuration file for safu.
safu_DIR:PATH=/usr/local/lib/cmake/safu

Usage of find_package

  • Always specify a version. find_package(dependecy X.Y.Z REQUIRED)

  • Specify the version used for development

  • The version doesn’t guarantee that in the future the build still works with this version.

  • The version does not necessarily say the previous versions will not work.

  • The version is just an indicator for later issue or bug tracking, to say: “It was developed with this version and it worked”.

  • Usually we always build against the latest available version of our dependencies, so we only can guarantee that the latest upstream version will work.