mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 02:25:53 +00:00
Improve subproj handling and deprecated target options:
Exclude several libraries from build when we are included in a super-project (this is the case when someone only wants to use xrpl_core). Force several target (deprecated) params to be cache variables since they are now exposed as options.
This commit is contained in:
@@ -50,11 +50,11 @@ macro(parse_target)
|
||||
endif()
|
||||
|
||||
if (${cur_component} STREQUAL unity)
|
||||
set(unity true)
|
||||
set(unity ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
if (${cur_component} STREQUAL nounity)
|
||||
set(unity false)
|
||||
set(unity OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
if (${cur_component} STREQUAL debug)
|
||||
@@ -66,12 +66,12 @@ macro(parse_target)
|
||||
endif()
|
||||
|
||||
if (${cur_component} STREQUAL coverage)
|
||||
set(coverage true)
|
||||
set(coverage ON CACHE BOOL "" FORCE)
|
||||
set(debug true)
|
||||
endif()
|
||||
|
||||
if (${cur_component} STREQUAL profile)
|
||||
set(profile true)
|
||||
set(profile ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
endwhile()
|
||||
endif()
|
||||
@@ -108,3 +108,10 @@ macro(group_sources curdir)
|
||||
group_sources_in(${PROJECT_SOURCE_DIR} ${curdir})
|
||||
endmacro()
|
||||
|
||||
macro (exclude_if_included target_)
|
||||
if (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
|
||||
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
|
||||
@@ -22,6 +22,12 @@ if (is_multiconfig STREQUAL "NOTFOUND")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
|
||||
set (is_root_project ON)
|
||||
else ()
|
||||
set (is_root_project OFF)
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") # both Clang and AppleClang
|
||||
set (is_clang TRUE)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
@@ -655,6 +661,7 @@ add_custom_command (TARGET lz4 POST_BUILD
|
||||
${CMAKE_BINARY_DIR}/lz4/include
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
$<TARGET_FILE:lz4> ${CMAKE_BINARY_DIR}/lz4/lib)
|
||||
exclude_if_included (lz4)
|
||||
|
||||
#[===================================================================[
|
||||
NIH dep: libarchive (via external project)
|
||||
@@ -805,6 +812,7 @@ add_custom_command (TARGET sqlite3 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
$<TARGET_FILE:sqlite3> ${CMAKE_BINARY_DIR}/sqlite3/lib
|
||||
BYPRODUCTS ${CMAKE_BINARY_DIR}/sqlite3/include/sqlite3.h)
|
||||
exclude_if_included (sqlite3)
|
||||
|
||||
#[===================================================================[
|
||||
NIH dep: soci
|
||||
@@ -840,6 +848,7 @@ target_link_libraries (soci
|
||||
Ripple::boost)
|
||||
add_library (NIH::soci ALIAS soci)
|
||||
target_link_libraries (ripple_libs INTERFACE NIH::soci)
|
||||
exclude_if_included (soci)
|
||||
|
||||
#[===================================================================[
|
||||
NIH dep: snappy
|
||||
@@ -862,6 +871,7 @@ target_include_directories (snappy
|
||||
src/snappy/config)
|
||||
add_library (NIH::snappy ALIAS snappy)
|
||||
target_link_libraries (ripple_libs INTERFACE NIH::snappy)
|
||||
exclude_if_included (snappy)
|
||||
|
||||
#[===================================================================[
|
||||
NIH dep: rocksdb
|
||||
@@ -908,6 +918,7 @@ else ()
|
||||
endif ()
|
||||
add_library (NIH::rocksdb ALIAS rocksdb)
|
||||
target_link_libraries (ripple_libs INTERFACE NIH::rocksdb)
|
||||
exclude_if_included (rocksdb)
|
||||
|
||||
#[===================================================================[
|
||||
NIH dep: nudb
|
||||
@@ -1012,6 +1023,7 @@ target_compile_options (pbufs
|
||||
>)
|
||||
add_library (Ripple::pbufs ALIAS pbufs)
|
||||
target_link_libraries (ripple_libs INTERFACE Ripple::pbufs)
|
||||
exclude_if_included (pbufs)
|
||||
|
||||
#[===================================================================[
|
||||
xrpl_core
|
||||
@@ -2012,6 +2024,7 @@ target_link_libraries (rippled
|
||||
Ripple::libs
|
||||
Ripple::boost
|
||||
Ripple::xrpl_core)
|
||||
exclude_if_included (rippled)
|
||||
|
||||
#[===================================================================[
|
||||
install stuff
|
||||
@@ -2041,7 +2054,7 @@ write_basic_package_version_file (
|
||||
VERSION ${rippled_version}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
|
||||
if (is_root_project)
|
||||
install (TARGETS rippled RUNTIME DESTINATION bin)
|
||||
set_target_properties(rippled PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
install (
|
||||
@@ -2063,9 +2076,6 @@ if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
|
||||
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/rippled-example.cfg\" etc rippled.cfg)
|
||||
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt)
|
||||
")
|
||||
else ()
|
||||
set_target_properties (rippled PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||
set_target_properties (rippled PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
|
||||
endif ()
|
||||
|
||||
#[===================================================================[
|
||||
|
||||
Reference in New Issue
Block a user