light/CMakeLists.txt

42 lines
1.4 KiB
Text
Raw Normal View History

cmake_minimum_required(VERSION 3.14)
2022-03-04 22:40:20 +03:30
project(Light)
2025-07-05 13:28:41 +03:30
set(CMAKE_CXX_STANDARD 23)
2025-07-21 12:29:29 +03:30
set(CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake)
include(${CMAKE_DIR}/functions.cmake)
include(${CMAKE_DIR}/definitions.cmake)
include(${CMAKE_DIR}/dependencies.cmake)
2025-07-20 14:53:58 +03:30
add_option(ENABLE_TESTS "Enables the building of the test modules")
2025-07-21 12:29:29 +03:30
add_option(ENABLE_STATIC_ANALYSIS "Makes clang-tidy checks mandatory for compilation")
if (ENABLE_STATIC_ANALYSIS)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks")
endif ()
2025-07-21 12:29:29 +03:30
add_option(ENABLE_LLVM_COVERAGE "Enables the code coverage instrumentation for clang")
if(ENABLE_LLVM_COVERAGE)
2025-07-20 14:53:58 +03:30
if (CMAKE_CXX_COMPILER_ID NOT STREQUAL "Clang")
2025-07-21 12:29:29 +03:30
message(FATAL_ERROR "ENABLE_LLVM_COVERAGE only supports the clang compiler")
2025-07-20 14:53:58 +03:30
endif ()
2025-07-21 12:29:29 +03:30
# Check for libc++
check_cxx_source_compiles("
#include <string>
#ifdef _LIBCPP_VERSION
int main() { return 0; }
#else
#error Not using libc++
#endif
" USING_LIBCXX)
if(NOT USING_LIBCXX)
message(FATAL_ERROR "ENABLE_LLVM_COVERAGE requires libc++, please compile with -stdlib=libc++")
endif()
2025-07-20 14:53:58 +03:30
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
endif ()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/modules)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/glad)