From 0380927f28ff6b5edcf2c25dce97ee2e74059472 Mon Sep 17 00:00:00 2001 From: Vladimir Chebotarev Date: Tue, 6 Dec 2016 16:35:28 +0300 Subject: [PATCH] cmake: Build fix. [#METR-23701] --- CMakeLists.txt | 6 +----- cmake/find_boost.cmake | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 cmake/find_boost.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 723535f0c5c..add6091a615 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,11 +197,7 @@ endif () set (ICU_LIBS ${ICUI18N} ${ICUUC} ${ICUDATA}) # 3. boost -set (Boost_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES}) -find_package (Boost 1.57 COMPONENTS program_options system filesystem regex thread) -if (NOT Boost_FOUND) - message (SEND_ERROR "Boost is required") -endif () +include (cmake/find_boost.cmake) # 4. ltdl set (LTDL_HINTS "/usr/local/opt/libtool/lib") diff --git a/cmake/find_boost.cmake b/cmake/find_boost.cmake new file mode 100644 index 00000000000..18593b2e1ba --- /dev/null +++ b/cmake/find_boost.cmake @@ -0,0 +1,19 @@ +set (Boost_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES}) +find_package (Boost 1.57 COMPONENTS program_options system filesystem regex thread) +if (NOT Boost_FOUND) + # Try to find manually. + set (BOOST_HINTS "") + if (USE_STATIC_LIBRARIES) + find_library (Boost_PROGRAM_OPTIONS_LIBRARY libboost_program_options.a HINTS ${BOOST_HINTS}) + find_library (Boost_SYSTEM_LIBRARY libboost_system.a HINTS ${BOOST_HINTS}) + find_library (Boost_FILESYSTEM_LIBRARY libboost_filesystem.a HINTS ${BOOST_HINTS}) + find_library (Boost_REGEX_LIBRARY libboost_regex.a HINTS ${BOOST_HINTS}) + find_library (Boost_THREAD_LIBRARY libboost_thread.a HINTS ${BOOST_HINTS}) + else () + find_library (Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options HINTS ${BOOST_HINTS}) + find_library (Boost_SYSTEM_LIBRARY boost_system HINTS ${BOOST_HINTS}) + find_library (Boost_FILESYSTEM_LIBRARY boost_filesystem HINTS ${BOOST_HINTS}) + find_library (Boost_REGEX_LIBRARY boost_regex HINTS ${BOOST_HINTS}) + find_library (Boost_THREAD_LIBRARY boost_thread HINTS ${BOOST_HINTS}) + endif () +endif ()