diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt index d4fdb8e9495ff..208069ee1f41d 100644 --- a/pulsar-client-cpp/CMakeLists.txt +++ b/pulsar-client-cpp/CMakeLists.txt @@ -153,12 +153,23 @@ else() endif (USE_LOG4CXX) endif (LINK_STATIC) + +find_package(Boost) +set(BOOST_COMPONENTS program_options regex) + +if (NOT Boost_VERSION_MAJOR OR + (Boost_VERSION_MAJOR EQUAL 1 AND Boost_VERSION_MINOR LESS 69) + ) + # Boost System does not require linking since 1.69 + set(BOOST_COMPONENTS ${BOOST_COMPONENTS} system) +endif() + if (MSVC) - find_package(Boost REQUIRED COMPONENTS program_options regex system date_time) -else() - find_package(Boost REQUIRED COMPONENTS program_options regex system) + set(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time) endif() +find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) + if (BUILD_PYTHON_WRAPPER) find_package(PythonLibs REQUIRED) MESSAGE(STATUS "PYTHON: " ${PYTHONLIBS_VERSION_STRING})