Skip to content

Commit a37fc31

Browse files
committed
Refactor cmake config: move glob search for tools
1 parent 40e37f8 commit a37fc31

File tree

3 files changed

+35
-36
lines changed

3 files changed

+35
-36
lines changed

CMakeLists.txt

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,6 @@ include(Options)
1414
# === Flags ===
1515
include(CompilerFlags)
1616

17-
# === Search All Source Files ===
18-
file(GLOB_RECURSE CORE_SOURCES
19-
CONFIGURE_DEPENDS
20-
src/*.cpp
21-
src/*.hpp
22-
include/*.hpp
23-
)
24-
25-
set(ALL_SOURCE_FILES ${CORE_SOURCES})
26-
27-
if(ENABLE_TESTING)
28-
file(GLOB_RECURSE TEST_SOURCES
29-
CONFIGURE_DEPENDS
30-
tests/*.cpp
31-
)
32-
list(APPEND ALL_SOURCE_FILES ${TEST_SOURCES})
33-
endif()
34-
35-
if(ENABLE_BENCHMARKS)
36-
file(GLOB_RECURSE BENCH_SOURCES
37-
CONFIGURE_DEPENDS
38-
benchmarks/*.cpp
39-
)
40-
list(APPEND ALL_SOURCE_FILES ${BENCH_SOURCES})
41-
endif()
42-
43-
if(BUILD_APP)
44-
file(GLOB_RECURSE APP_SOURCES
45-
CONFIGURE_DEPENDS
46-
app/*.cpp
47-
)
48-
list(APPEND ALL_SOURCE_FILES ${APP_SOURCES})
49-
endif()
50-
5117
# === Helpers ===
5218
include(Helpers)
5319

cmake/Options.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ option(ENABLE_TESTING "Build unit tests" ON)
55
option(ENABLE_BENCHMARKS "Build benchmarks" OFF)
66
option(ENABLE_COVERAGE "Enable coverage instrumentation" OFF)
77
option(BUILD_APP "Build the demo application" OFF)
8-
option(ENABLE_SANITIZERS "Enable ASan / UBSan / MSan" OFF)
8+
option(ENABLE_SANITIZERS "Enable ASan / UBSan" OFF)
99
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
1010
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer" OFF)
1111
option(ENABLE_CPPCHECK "Enable Cppcheck integration" ON)
@@ -16,5 +16,4 @@ option(ENABLE_CLANG_FORMAT "Enable clang-format integration" ON)
1616
if(ENABLE_SANITIZERS)
1717
set(ENABLE_ASAN ON CACHE BOOL "" FORCE)
1818
set(ENABLE_UBSAN ON CACHE BOOL "" FORCE)
19-
set(ENABLE_MSAN ON CACHE BOOL "" FORCE)
2019
endif()

cmake/Tooling.cmake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
# === Search All Source Files ===
2+
file(GLOB_RECURSE CORE_SOURCES
3+
CONFIGURE_DEPENDS
4+
${CMAKE_SOURCE_DIR}/src/*.cpp
5+
${CMAKE_SOURCE_DIR}/src/*.hpp
6+
${CMAKE_SOURCE_DIR}/include/*.hpp
7+
)
8+
9+
set(ALL_SOURCE_FILES ${CORE_SOURCES})
10+
11+
if(ENABLE_TESTING)
12+
file(GLOB_RECURSE TEST_SOURCES
13+
CONFIGURE_DEPENDS
14+
${CMAKE_SOURCE_DIR}/tests/*.cpp
15+
)
16+
list(APPEND ALL_SOURCE_FILES ${TEST_SOURCES})
17+
endif()
18+
19+
if(ENABLE_BENCHMARKS)
20+
file(GLOB_RECURSE BENCH_SOURCES
21+
CONFIGURE_DEPENDS
22+
${CMAKE_SOURCE_DIR}/benchmarks/*.cpp
23+
)
24+
list(APPEND ALL_SOURCE_FILES ${BENCH_SOURCES})
25+
endif()
26+
27+
if(BUILD_APP)
28+
file(GLOB_RECURSE APP_SOURCES
29+
CONFIGURE_DEPENDS
30+
${CMAKE_SOURCE_DIR}/app/*.cpp
31+
)
32+
list(APPEND ALL_SOURCE_FILES ${APP_SOURCES})
33+
endif()
34+
135
# clang-format
236
if(ENABLE_CLANG_FORMAT)
337
find_program(CLANG_FORMAT_EXE clang-format)

0 commit comments

Comments
 (0)