Skip to content

Commit eb12caa

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 b7712da commit eb12caa

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
@@ -17,18 +17,6 @@ include("cmake/Hunter/init.cmake")
1717
cmake_policy(SET CMP0048 NEW)
1818
project(libp2p VERSION 0.0.1 LANGUAGES C CXX)
1919

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

3422
option(TESTING "Build tests" ON)
@@ -44,6 +32,18 @@ option(TSAN "Enable thread sanitizer" OFF)
4432
option(UBSAN "Enable UB sanitizer" OFF)
4533
option(EXPOSE_MOCKS "Make mocks header files visible for child projects" OFF)
4634

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

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

0 commit comments

Comments
 (0)