light/tools/cmake/options.cmake
light7734 01f20c325a
Some checks reported errors
continuous-integration/drone/push Build was killed
build: removed unused cmake code + minor renaming
2026-02-13 13:24:35 +03:30

36 lines
1.1 KiB
CMake

function(add_option option help)
option(${option} ${help})
if(${option})
message(STATUS "${option}: ON")
add_compile_definitions(${option}=1)
else()
message(STATUS "${option}: OFF")
endif()
endfunction()
add_option(ENABLE_SANDBOX "Enables the building of the sandbox module for experimentation")
add_option(ENABLE_UNIT_TESTS "Enables the building of the unit test modules")
add_option(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules")
add_option(
ENABLE_STATIC_ANALYSIS
"Makes the clang-tidy checks mandatory for compilation"
)
add_option(
ENABLE_LLVM_COVERAGE "Enables the code coverage instrumentation for clang"
)
if(ENABLE_STATIC_ANALYSIS)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks")
endif()
if(ENABLE_LLVM_COVERAGE)
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message(
FATAL_ERROR "ENABLE_LLVM_COVERAGE only supports the clang compiler"
)
endif()
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
endif()