Skip to content

Commit 17499a5

Browse files
committed
[PR 128] CMake: Expose CMake options to includes
This change shuffles the order of several CMake steps to expose CMake options to included files. By defining options before inclusion, included files are able to access the input provided by the build system.
1 parent ddb7c16 commit 17499a5

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

CMakeLists.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,9 @@ endif ()
3535

3636
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3737

38-
include(CheckCXXCompilerFlag)
39-
include(cmake/toolchain-util.cmake)
40-
include(cmake/dependencies.cmake)
41-
include(cmake/functions.cmake)
42-
include(cmake/san.cmake)
43-
4438
# export compile commands for clang-tidy to analyse only changed files
4539
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
4640

47-
print("C flags: ${CMAKE_C_FLAGS}")
48-
print("CXX flags: ${CMAKE_CXX_FLAGS}")
49-
print("Using CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
50-
5141
option(TESTING "Build tests" ON)
5242
option(CLANG_FORMAT "Enable clang-format target" ON)
5343
option(CLANG_TIDY "Enable clang-tidy checks during compilation" OFF)
@@ -59,6 +49,15 @@ option(MSAN "Enable memory sanitizer" OFF)
5949
option(TSAN "Enable thread sanitizer" OFF)
6050
option(UBSAN "Enable UB sanitizer" OFF)
6151

52+
include(CheckCXXCompilerFlag)
53+
include(cmake/toolchain-util.cmake)
54+
include(cmake/dependencies.cmake)
55+
include(cmake/functions.cmake)
56+
include(cmake/san.cmake)
57+
58+
print("C flags: ${CMAKE_C_FLAGS}")
59+
print("CXX flags: ${CMAKE_CXX_FLAGS}")
60+
print("Using CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
6261

6362
## setup compilation flags
6463
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(AppleClang|Clang|GNU)$")

0 commit comments

Comments
 (0)