diff options
author | Brad King <brad.king@kitware.com> | 2017-09-18 14:09:20 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-18 14:09:48 (GMT) |
commit | d31b1c0e990171e6bc6780b01ab5df0dafc3ab9c (patch) | |
tree | 7a5ed3a5a7a89cb7c004db986b0ec5ad039ad3b0 /Modules | |
parent | 836f42b3c0ff25389bfad4d8dd3de6798f2d3eb9 (diff) | |
parent | 3080a0a61129fae4a2221d333add8b352a78aa66 (diff) | |
download | CMake-d31b1c0e990171e6bc6780b01ab5df0dafc3ab9c.zip CMake-d31b1c0e990171e6bc6780b01ab5df0dafc3ab9c.tar.gz CMake-d31b1c0e990171e6bc6780b01ab5df0dafc3ab9c.tar.bz2 |
Merge topic 'FindBoost-no-find_dependency'
3080a0a6 FindBoost: Improve behavior when thread dependency is missing
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1272
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindBoost.cmake | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 614a7ca..b3d204b 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -76,7 +76,7 @@ # Boost::system will be automatically detected and satisfied, even # if system is not specified when using find_package and if # Boost::system is not added to target_link_libraries. If using -# Boost::thread, then Thread::Thread will also be added automatically. +# Boost::thread, then Threads::Threads will also be added automatically. # # It is important to note that the imported targets behave differently # than variables created by this module: multiple calls to @@ -307,6 +307,10 @@ macro(_Boost_ADJUST_LIB_VARS basename) if(Boost_${basename}_LIBRARY AND Boost_${basename}_HEADER) set(Boost_${basename}_FOUND ON) + if("x${basename}" STREQUAL "xTHREAD" AND NOT TARGET Threads::Threads) + string(APPEND Boost_ERROR_REASON_THREAD " (missing dependency: Threads)") + set(Boost_THREAD_FOUND OFF) + endif() endif() endif() @@ -1539,8 +1543,13 @@ _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS) # If thread is required, get the thread libs as a dependency list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS) if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1) - include(CMakeFindDependencyMacro) - find_dependency(Threads) + if(Boost_FIND_QUIETLY) + set(_Boost_find_quiet QUIET) + else() + set(_Boost_find_quiet "") + endif() + find_package(Threads ${_Boost_find_quiet}) + unset(_Boost_find_quiet) endif() # If the user changed any of our control inputs flush previous results. @@ -1770,8 +1779,9 @@ if(Boost_FOUND) string(APPEND Boost_ERROR_REASON " Boost libraries:\n") foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) string(APPEND Boost_ERROR_REASON - " ${Boost_NAMESPACE}_${COMPONENT}\n") + " ${Boost_NAMESPACE}_${COMPONENT}${Boost_ERROR_REASON_${UPPERCOMPONENT}}\n") endforeach() list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) |