cmake: Introduce interface libraries to encapsulate common flags

Also add a sanity check for non-encapsulated (directory-wide) build
properties.
This commit is contained in:
Hennadii Stepanov committed 2024-08-16 19:27:34 +01:00
1 parent a2317e27b7
commit 70683884c5
2 files changed
+52

No files matched your search

+16
View File
@@ -59,8 +59,21 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
set(configure_warnings)
# The core_interface library aims to encapsulate common build flags.
# It is a usage requirement for all targets except for secp256k1, which
# gets its flags by other means.
add_library(core_interface INTERFACE)
add_library(core_interface_relwithdebinfo INTERFACE)
add_library(core_interface_debug INTERFACE)
target_link_libraries(core_interface INTERFACE
$<$<CONFIG:RelWithDebInfo>:core_interface_relwithdebinfo>
$<$<CONFIG:Debug>:core_interface_debug>
)
message("\n")
message("Configure summary")
message("=================")
@@ -73,3 +86,6 @@ if(configure_warnings)
endforeach()
message(" ******\n")
endif()
# We want all build properties to be encapsulated properly.
include(WarnAboutGlobalProperties)