summaryrefslogtreecommitdiffstats
path: root/Modules/FindBoost.cmake
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2017-04-23 14:30:31 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-18 17:44:25 (GMT)
commita929dd166e16cd7b3aa4c9352faaf3b01bc61101 (patch)
tree16bb3b91740f8528344ecdefdc3997191893cdcb /Modules/FindBoost.cmake
parenta1cdf537ffb33db3a368dc4c2c3662fa27568400 (diff)
downloadCMake-a929dd166e16cd7b3aa4c9352faaf3b01bc61101.zip
CMake-a929dd166e16cd7b3aa4c9352faaf3b01bc61101.tar.gz
CMake-a929dd166e16cd7b3aa4c9352faaf3b01bc61101.tar.bz2
FindBoost: Simplify search in lists
Instead of `list(FIND...)` and then checking result for `-1` (found/not-found), nowadays `if` command has the `IN_LIST` test for that. This change was originally made by commit v3.9.0-rc1~41^2 (FindBoost: Simplify search in lists, 2017-04-23) but then had to be reverted by commit v3.9.2~3^2 (FindBoost: Revert "Simplify search in lists.", 2017-09-05) due to problems related to using `find_dependency`. Those problems were addressed by commit 3080a0a611 (FindBoost: Improve behavior when thread dependency is missing, 2017-09-15), so now we can restore the original change. Issue: #17252
Diffstat (limited to 'Modules/FindBoost.cmake')
-rw-r--r--Modules/FindBoost.cmake14
1 files changed, 9 insertions, 5 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index b3d204b..6d1514d 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -214,6 +214,10 @@
#
# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
+# Save project's policies
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
#-------------------------------------------------------------------------------
# Before we go searching, check whether boost-cmake is available, unless the
# user specifically asked NOT to search for boost-cmake.
@@ -905,9 +909,7 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
- list(FIND _boost_processed_components "${componentdep}" _boost_component_found)
- list(FIND _boost_new_components "${componentdep}" _boost_component_new)
- if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1)
+ if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components))
list(APPEND _boost_new_components ${componentdep})
endif()
endforeach()
@@ -1541,8 +1543,7 @@ endif()
_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)
+if("thread" IN_LIST Boost_FIND_COMPONENTS)
if(Boost_FIND_QUIETLY)
set(_Boost_find_quiet QUIET)
else()
@@ -1977,3 +1978,6 @@ list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
list(SORT _Boost_COMPONENTS_SEARCHED)
set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
CACHE INTERNAL "Components requested for this build tree.")
+
+# Restore project's policies
+cmake_policy(POP)