@@ -1075,29 +1075,39 @@ if(STATIC)
1075
1075
set (Boost_USE_STATIC_LIBS ON )
1076
1076
set (Boost_USE_STATIC_RUNTIME ON )
1077
1077
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
1082
1078
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
+
1084
1083
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" )
1086
1085
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 )
1093
1093
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 )
1098
1098
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} )
1099
1105
endif ()
1100
1106
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
+
1101
1111
include_directories (SYSTEM ${Boost_INCLUDE_DIRS} )
1102
1112
if (MINGW)
1103
1113
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj" )
0 commit comments