aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2024-10-13 15:19:46 +0200
committertobtoht <tob@featherwallet.org>2024-10-13 15:26:22 +0200
commit366eb60ee33396bd9f79bf445b0b1e3339063a55 (patch)
tree81a31664f0a44350c5d123727643108a03977b21 /CMakeLists.txt
parent83dd5152e6d115426afbb57a94a832ec91b58a46 (diff)
downloadmonzero-core-366eb60ee33396bd9f79bf445b0b1e3339063a55.tar.gz
monzero-core-366eb60ee33396bd9f79bf445b0b1e3339063a55.tar.xz
monzero-core-366eb60ee33396bd9f79bf445b0b1e3339063a55.zip
cmake: boost: fix header-only library search, bump minimum
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt42
1 files changed, 26 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b77c3739..d49316a7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1075,29 +1075,39 @@ if(STATIC)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
-find_package(Boost 1.58 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale)
-add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
-add_definitions(-DBOOST_NO_AUTO_PTR)
-add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property
-set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
+# Find Boost headers
+set(BOOST_MIN_VER 1.62)
+find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED)
+
if(NOT Boost_FOUND)
- die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=1.58) or the equivalent")
+ die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=${BOOST_MIN_VER}) or the equivalent")
elseif(Boost_FOUND)
- message(STATUS "Found Boost Version: ${Boost_VERSION}")
- if (Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 1.62.0 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
- set(BOOST_BEFORE_1_62 true)
- endif()
- if (NOT Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 106200 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
- set(BOOST_BEFORE_1_62 true)
+ message(STATUS "Found Boost Version: ${Boost_VERSION_STRING}")
+
+ set(BOOST_COMPONENTS filesystem thread date_time chrono serialization program_options locale)
+
+ # Boost System is header-only since 1.69
+ if (Boost_VERSION_STRING VERSION_LESS 1.69.0)
+ list(APPEND BOOST_COMPONENTS system)
endif()
- if (BOOST_BEFORE_1_62)
- message(FATAL_ERROR "Boost ${Boost_VERSION} (older than 1.62) is too old to link with OpenSSL ${OPENSSL_VERSION} (1.1 or newer) found at ${OPENSSL_INCLUDE_DIR} and ${OPENSSL_LIBRARIES}. "
- "Update Boost or install OpenSSL 1.0 and set path to it when running cmake: "
- "cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0'")
+
+ # Boost Regex is header-only since 1.77
+ if (Boost_VERSION_STRING VERSION_LESS 1.77.0)
+ list(APPEND BOOST_COMPONENTS regex)
endif()
+
+ message(STATUS "Boost components: ${BOOST_COMPONENTS}")
+
+ # Find required Boost libraries
+ find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
endif()
+add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
+add_definitions(-DBOOST_NO_AUTO_PTR)
+add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property
+
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")