-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
52 lines (47 loc) · 1.45 KB
/
CMakeLists.txt
File metadata and controls
52 lines (47 loc) · 1.45 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
cmake_minimum_required(VERSION 3.21)
project(
libut
VERSION 0.1.0
DESCRIPTION "Various useful bits of C++"
HOMEPAGE_URL "https://github.com/dk949/libut"
LANGUAGES CXX
)
include(cmake/install.cmake)
include(cmake/targets.cmake)
file(GLOB includes "${CMAKE_CURRENT_SOURCE_DIR}/include/*")
add_library(ut INTERFACE)
foreach (include ${includes})
add_subdirectory("${include}")
cmake_path(GET include FILENAME module_name)
target_link_libraries(ut INTERFACE ut_${module_name})
list(APPEND LIBUT_TARGET_LIST ut_${module_name})
endforeach ()
if (NOT TARGET ut::ut)
add_library(ut::ut ALIAS ut)
endif ()
list(APPEND LIBUT_TARGET_LIST ut)
set(LIBUT_TARGET_LIST
"${LIBUT_TARGET_LIST}"
)
message(STATUS "libut: adding ut::ut")
libut_install()
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_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory(tests)
endif ()
endif ()