Skip to content

Commit 58a1d54

Browse files
committed
Merge pull request monero-project#9517
366eb60 cmake: boost: fix header-only library search, bump minimum (tobtoht)
2 parents 83dd515 + 366eb60 commit 58a1d54

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

CMakeLists.txt

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,29 +1075,39 @@ if(STATIC)
10751075
set(Boost_USE_STATIC_LIBS ON)
10761076
set(Boost_USE_STATIC_RUNTIME ON)
10771077
endif()
1078-
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale)
1079-
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
1080-
add_definitions(-DBOOST_NO_AUTO_PTR)
1081-
add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property
10821078

1083-
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
1079+
# Find Boost headers
1080+
set(BOOST_MIN_VER 1.62)
1081+
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED)
1082+
10841083
if(NOT Boost_FOUND)
1085-
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=1.58) or the equivalent")
1084+
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=${BOOST_MIN_VER}) or the equivalent")
10861085
elseif(Boost_FOUND)
1087-
message(STATUS "Found Boost Version: ${Boost_VERSION}")
1088-
if (Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 1.62.0 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
1089-
set(BOOST_BEFORE_1_62 true)
1090-
endif()
1091-
if (NOT Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 106200 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
1092-
set(BOOST_BEFORE_1_62 true)
1086+
message(STATUS "Found Boost Version: ${Boost_VERSION_STRING}")
1087+
1088+
set(BOOST_COMPONENTS filesystem thread date_time chrono serialization program_options locale)
1089+
1090+
# Boost System is header-only since 1.69
1091+
if (Boost_VERSION_STRING VERSION_LESS 1.69.0)
1092+
list(APPEND BOOST_COMPONENTS system)
10931093
endif()
1094-
if (BOOST_BEFORE_1_62)
1095-
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}. "
1096-
"Update Boost or install OpenSSL 1.0 and set path to it when running cmake: "
1097-
"cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0'")
1094+
1095+
# Boost Regex is header-only since 1.77
1096+
if (Boost_VERSION_STRING VERSION_LESS 1.77.0)
1097+
list(APPEND BOOST_COMPONENTS regex)
10981098
endif()
1099+
1100+
message(STATUS "Boost components: ${BOOST_COMPONENTS}")
1101+
1102+
# Find required Boost libraries
1103+
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
1104+
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
10991105
endif()
11001106

1107+
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
1108+
add_definitions(-DBOOST_NO_AUTO_PTR)
1109+
add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property
1110+
11011111
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
11021112
if(MINGW)
11031113
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ library archives (`.a`).
168168
| GCC | 5 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
169169
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
170170
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | |
171-
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
171+
| Boost | 1.62 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
172172
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `libressl-devel` | `openssl-devel` | NO | sha256 sum |
173173
| libzmq | 4.2.0 | NO | `libzmq3-dev` | `zeromq` | `zeromq-devel` | `zeromq-devel` | NO | ZeroMQ library |
174174
| OpenPGM | ? | NO | `libpgm-dev` | `libpgm` | | `openpgm-devel` | NO | For ZeroMQ |

0 commit comments

Comments
 (0)