Skip to content

Commit 0a0238a

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 f611ebe commit 0a0238a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

CMakeLists.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,6 @@ set(CMAKE_TOOLCHAIN_FILE
1616
include("cmake/Hunter/init.cmake")
1717
project(libp2p C CXX)
1818

19-
include(cmake/print.cmake)
20-
print("C flags: ${CMAKE_C_FLAGS}")
21-
print("CXX flags: ${CMAKE_CXX_FLAGS}")
22-
print("Using CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
23-
24-
include(CheckCXXCompilerFlag)
25-
include(cmake/install.cmake)
26-
include(cmake/libp2p_add_library.cmake)
27-
include(cmake/dependencies.cmake)
28-
include(cmake/functions.cmake)
29-
include(cmake/san.cmake)
30-
3119
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3220

3321
option(TESTING "Build tests" ON)
@@ -41,6 +29,18 @@ option(MSAN "Enable memory sanitizer" OFF)
4129
option(TSAN "Enable thread sanitizer" OFF)
4230
option(UBSAN "Enable UB sanitizer" OFF)
4331

32+
include(CheckCXXCompilerFlag)
33+
include(cmake/install.cmake)
34+
include(cmake/libp2p_add_library.cmake)
35+
include(cmake/dependencies.cmake)
36+
include(cmake/functions.cmake)
37+
include(cmake/san.cmake)
38+
39+
include(cmake/print.cmake)
40+
print("C flags: ${CMAKE_C_FLAGS}")
41+
print("CXX flags: ${CMAKE_CXX_FLAGS}")
42+
print("Using CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
43+
4444

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

0 commit comments

Comments
 (0)