-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
34 lines (29 loc) · 1.11 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
cmake_minimum_required(VERSION 3.21)
project(libut LANGUAGES CXX)
file(GLOB includes "${CMAKE_CURRENT_SOURCE_DIR}/include/*")
add_library(libut_target_all INTERFACE)
foreach(include ${includes})
add_subdirectory("${include}")
cmake_path(GET include FILENAME module_name)
target_link_libraries(libut_target_all INTERFACE "libut_target_${module_name}")
endforeach()
add_library(UT::all ALIAS libut_target_all)
message(STATUS "libut: adding UT::all")
if (PROJECT_IS_TOP_LEVEL)
option(ENABLE_TESTING "Should tests be enabled?" ON)
if(ENABLE_TESTING)
if (ENABLE_CACHE)
find_program(cache_bin ccache)
if (cache_bin)
message(STATUS "ccache found and enabled")
set(CMAKE_CXX_COMPILER_LAUNCHER ${cache_bin} CACHE STRING "cmake compiler launcher")
else ()
message(WARNING "ccache is enabled but was not found. Not using it")
endif ()
endif ()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory(tests)
endif()
endif()