Skip to content

Commit 52c72eb

Browse files
committed
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 69f3021 commit 52c72eb

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(TESTING_PROOFS "Build proofs tests" OFF)
5343
option(CLANG_FORMAT "Enable clang-format target" ON)
@@ -60,6 +50,15 @@ option(MSAN "Enable memory sanitizer" OFF)
6050
option(TSAN "Enable thread sanitizer" OFF)
6151
option(UBSAN "Enable UB sanitizer" OFF)
6252

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

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

0 commit comments

Comments
 (0)