From 5b020222c076b41b47072e5bda17d875f6fb053a Mon Sep 17 00:00:00 2001 From: Michael Legleux Date: Thu, 24 Mar 2022 11:40:34 -0700 Subject: [PATCH] Remove checks for CMake < 3.16 --- Builds/CMake/RippledCore.cmake | 18 ++++----- Builds/CMake/RippledSettings.cmake | 9 +---- Builds/CMake/RippledValidatorKeys.cmake | 4 +- Builds/CMake/deps/Libarchive.cmake | 2 +- Builds/CMake/deps/Lz4.cmake | 2 +- Builds/CMake/deps/Nudb.cmake | 54 +++++++++---------------- Builds/CMake/deps/Protobuf.cmake | 2 +- Builds/CMake/deps/Rocksdb.cmake | 2 +- Builds/CMake/deps/Snappy.cmake | 2 +- Builds/CMake/deps/Soci.cmake | 2 +- Builds/CMake/deps/Sqlite.cmake | 2 +- Builds/CMake/deps/date.cmake | 43 +++----------------- Builds/CMake/deps/gRPC.cmake | 6 +-- CMakeLists.txt | 7 +--- 14 files changed, 47 insertions(+), 108 deletions(-) diff --git a/Builds/CMake/RippledCore.cmake b/Builds/CMake/RippledCore.cmake index 6b5e9a521eb..c01077a5aa2 100644 --- a/Builds/CMake/RippledCore.cmake +++ b/Builds/CMake/RippledCore.cmake @@ -998,13 +998,11 @@ message(STATUS "Reporting mode build: rippled renamed ${BIN_NAME}") target_compile_definitions(rippled PRIVATE RIPPLED_REPORTING) endif() -if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16) - # any files that don't play well with unity should be added here - if (tests) - set_source_files_properties( - # these two seem to produce conflicts in beast teardown template methods - src/test/rpc/ValidatorRPC_test.cpp - src/test/rpc/ShardArchiveHandler_test.cpp - PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE) - endif () #tests -endif () +# any files that don't play well with unity should be added here +if (tests) + set_source_files_properties( + # these two seem to produce conflicts in beast teardown template methods + src/test/rpc/ValidatorRPC_test.cpp + src/test/rpc/ShardArchiveHandler_test.cpp + PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE) +endif () #tests diff --git a/Builds/CMake/RippledSettings.cmake b/Builds/CMake/RippledSettings.cmake index 5fcc9441a84..0cdfb8e84db 100644 --- a/Builds/CMake/RippledSettings.cmake +++ b/Builds/CMake/RippledSettings.cmake @@ -10,13 +10,8 @@ option (tests "Build tests" ON) option (unity "Creates a build using UNITY support in cmake. This is the default" ON) if (unity) - if (CMAKE_VERSION VERSION_LESS 3.16) - message (WARNING "unity option only supported for with cmake 3.16+ (please upgrade)") - set (unity OFF CACHE BOOL "unity only available for cmake 3.16+" FORCE) - else () - if (NOT is_ci) - set (CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "") - endif () + if (NOT is_ci) + set (CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "") endif () endif () if (is_gcc OR is_clang) diff --git a/Builds/CMake/RippledValidatorKeys.cmake b/Builds/CMake/RippledValidatorKeys.cmake index 2cf71f22365..dfd56f9f182 100644 --- a/Builds/CMake/RippledValidatorKeys.cmake +++ b/Builds/CMake/RippledValidatorKeys.cmake @@ -1,6 +1,6 @@ option (validator_keys "Enables building of validator-keys-tool as a separate target (imported via FetchContent)" OFF) -if (validator_keys AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) +if (validator_keys) git_branch (current_branch) # default to tracking VK develop branch unless we are on master/release if (NOT (current_branch STREQUAL "master" OR current_branch STREQUAL "release")) @@ -20,5 +20,3 @@ if (validator_keys AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) endif () add_subdirectory (${validator_keys_src_SOURCE_DIR} ${CMAKE_BINARY_DIR}/validator-keys) endif () - - diff --git a/Builds/CMake/deps/Libarchive.cmake b/Builds/CMake/deps/Libarchive.cmake index 760f6403afd..57b8d2e395b 100644 --- a/Builds/CMake/deps/Libarchive.cmake +++ b/Builds/CMake/deps/Libarchive.cmake @@ -125,7 +125,7 @@ if (local_libarchive) --build . --config $ --target archive_static - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} $<$: COMMAND ${CMAKE_COMMAND} -E copy diff --git a/Builds/CMake/deps/Lz4.cmake b/Builds/CMake/deps/Lz4.cmake index f5e6fa5acf0..15d890692c5 100644 --- a/Builds/CMake/deps/Lz4.cmake +++ b/Builds/CMake/deps/Lz4.cmake @@ -43,7 +43,7 @@ else() --build . --config $ --target lz4_static - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} $<$: COMMAND ${CMAKE_COMMAND} -E copy diff --git a/Builds/CMake/deps/Nudb.cmake b/Builds/CMake/deps/Nudb.cmake index 8bdb0c06f89..73ab58898a9 100644 --- a/Builds/CMake/deps/Nudb.cmake +++ b/Builds/CMake/deps/Nudb.cmake @@ -8,40 +8,24 @@ if (is_root_project) # NuDB not needed in the case of xrpl_core inclusion build add_library (nudb INTERFACE) - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) - FetchContent_Declare( - nudb_src - GIT_REPOSITORY https://github.com/CPPAlliance/NuDB.git - GIT_TAG 2.0.5 - ) - FetchContent_GetProperties(nudb_src) - if(NOT nudb_src_POPULATED) - message (STATUS "Pausing to download NuDB...") - FetchContent_Populate(nudb_src) - endif() - else () - ExternalProject_Add (nudb_src - PREFIX ${nih_cache_path} - GIT_REPOSITORY https://github.com/CPPAlliance/NuDB.git - GIT_TAG 2.0.5 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - TEST_COMMAND "" - INSTALL_COMMAND "" - ) - ExternalProject_Get_Property (nudb_src SOURCE_DIR) - set (nudb_src_SOURCE_DIR "${SOURCE_DIR}") - file (MAKE_DIRECTORY ${nudb_src_SOURCE_DIR}/include) - add_dependencies (nudb nudb_src) - endif () + FetchContent_Declare( + nudb_src + GIT_REPOSITORY https://github.com/CPPAlliance/NuDB.git + GIT_TAG 2.0.5 + ) + FetchContent_GetProperties(nudb_src) + if(NOT nudb_src_POPULATED) + message (STATUS "Pausing to download NuDB...") + FetchContent_Populate(nudb_src) + endif() +endif () - file(TO_CMAKE_PATH "${nudb_src_SOURCE_DIR}" nudb_src_SOURCE_DIR) +file(TO_CMAKE_PATH "${nudb_src_SOURCE_DIR}" nudb_src_SOURCE_DIR) # specify as system includes so as to avoid warnings - target_include_directories (nudb SYSTEM INTERFACE ${nudb_src_SOURCE_DIR}/include) - target_link_libraries (nudb - INTERFACE - Boost::thread - Boost::system) - add_library (NIH::nudb ALIAS nudb) - target_link_libraries (ripple_libs INTERFACE NIH::nudb) -endif () +target_include_directories (nudb SYSTEM INTERFACE ${nudb_src_SOURCE_DIR}/include) +target_link_libraries (nudb + INTERFACE + Boost::thread + Boost::system) +add_library (NIH::nudb ALIAS nudb) +target_link_libraries (ripple_libs INTERFACE NIH::nudb) diff --git a/Builds/CMake/deps/Protobuf.cmake b/Builds/CMake/deps/Protobuf.cmake index 52cbd3f5ab9..35d5b9f0ff7 100644 --- a/Builds/CMake/deps/Protobuf.cmake +++ b/Builds/CMake/deps/Protobuf.cmake @@ -65,7 +65,7 @@ if (local_protobuf OR NOT (Protobuf_FOUND AND Protobuf_PROTOC_EXECUTABLE AND pro ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} TEST_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --config $ --target install diff --git a/Builds/CMake/deps/Rocksdb.cmake b/Builds/CMake/deps/Rocksdb.cmake index 6a33a8d2b57..2c832c593f5 100644 --- a/Builds/CMake/deps/Rocksdb.cmake +++ b/Builds/CMake/deps/Rocksdb.cmake @@ -136,7 +136,7 @@ if (local_rocksdb) ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} $<$: COMMAND ${CMAKE_COMMAND} -E copy diff --git a/Builds/CMake/deps/Snappy.cmake b/Builds/CMake/deps/Snappy.cmake index 9792bec1b5e..331ac2fbe95 100644 --- a/Builds/CMake/deps/Snappy.cmake +++ b/Builds/CMake/deps/Snappy.cmake @@ -42,7 +42,7 @@ else() ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} $<$: COMMAND ${CMAKE_COMMAND} -E copy diff --git a/Builds/CMake/deps/Soci.cmake b/Builds/CMake/deps/Soci.cmake index 4015a3f2dea..fa05a115756 100644 --- a/Builds/CMake/deps/Soci.cmake +++ b/Builds/CMake/deps/Soci.cmake @@ -113,7 +113,7 @@ else() ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} $<$: COMMAND ${CMAKE_COMMAND} -E copy diff --git a/Builds/CMake/deps/Sqlite.cmake b/Builds/CMake/deps/Sqlite.cmake index a2d0bad5ac7..7b34c1121f2 100644 --- a/Builds/CMake/deps/Sqlite.cmake +++ b/Builds/CMake/deps/Sqlite.cmake @@ -56,7 +56,7 @@ else() ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} $<$: COMMAND ${CMAKE_COMMAND} -E copy diff --git a/Builds/CMake/deps/date.cmake b/Builds/CMake/deps/date.cmake index 0f15e7d181c..b9155c26475 100644 --- a/Builds/CMake/deps/date.cmake +++ b/Builds/CMake/deps/date.cmake @@ -9,41 +9,10 @@ find_package (date QUIET) if (NOT TARGET date::date) - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.14) - FetchContent_Declare( - hh_date_src - GIT_REPOSITORY https://github.com/HowardHinnant/date.git - GIT_TAG fc4cf092f9674f2670fb9177edcdee870399b829 - ) - FetchContent_MakeAvailable(hh_date_src) - else () - ExternalProject_Add (hh_date_src - PREFIX ${nih_cache_path} - GIT_REPOSITORY https://github.com/HowardHinnant/date.git - GIT_TAG fc4cf092f9674f2670fb9177edcdee870399b829 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - TEST_COMMAND "" - INSTALL_COMMAND "" - ) - ExternalProject_Get_Property (hh_date_src SOURCE_DIR) - set (hh_date_src_SOURCE_DIR "${SOURCE_DIR}") - file (MAKE_DIRECTORY ${hh_date_src_SOURCE_DIR}/include) - add_library (date_interface INTERFACE) - add_library (date::date ALIAS date_interface) - add_dependencies (date_interface hh_date_src) - file (TO_CMAKE_PATH "${hh_date_src_SOURCE_DIR}" hh_date_src_SOURCE_DIR) - target_include_directories (date_interface - SYSTEM INTERFACE - $ - $) - install ( - FILES - ${hh_date_src_SOURCE_DIR}/include/date/date.h - DESTINATION include/date) - install (TARGETS date_interface - EXPORT RippleExports - INCLUDES DESTINATION include) - endif () + FetchContent_Declare( + hh_date_src + GIT_REPOSITORY https://github.com/HowardHinnant/date.git + GIT_TAG fc4cf092f9674f2670fb9177edcdee870399b829 + ) + FetchContent_MakeAvailable(hh_date_src) endif () - diff --git a/Builds/CMake/deps/gRPC.cmake b/Builds/CMake/deps/gRPC.cmake index 92a75107140..8dd09417563 100644 --- a/Builds/CMake/deps/gRPC.cmake +++ b/Builds/CMake/deps/gRPC.cmake @@ -112,7 +112,7 @@ else () ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} TEST_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --config $ --target install @@ -169,7 +169,7 @@ else () ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} TEST_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --config $ --target install @@ -237,7 +237,7 @@ else () ${CMAKE_COMMAND} --build . --config $ - $<$:--parallel ${ep_procs}> + --parallel ${ep_procs} $<$: COMMAND ${CMAKE_COMMAND} -E copy diff --git a/CMakeLists.txt b/CMakeLists.txt index ade87d3498e..c5e750d7b41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,12 +25,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake/deps") include (CheckCXXCompilerFlag) -if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) - include (FetchContent) -endif () -if (MSVC AND CMAKE_VERSION VERSION_LESS 3.12) - message (FATAL_ERROR "MSVC requires cmake 3.12 or greater for proper boost support") -endif () +include (FetchContent) include (ExternalProject) include (CMakeFuncs) # must come *after* ExternalProject b/c it overrides one function in EP include (ProcessorCount)