summaryrefslogtreecommitdiff
path: root/Modules/FindBoost.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-09-16 10:30:32 -0400
committerBrad King <brad.king@kitware.com>2008-09-16 10:30:32 -0400
commit79a38073400e7e47696064af240de40e24257cf0 (patch)
treed242f0b37fc8edf0ed002b2a88a689042c2056ce /Modules/FindBoost.cmake
parentccc7ca98711f5902d54d055b65b5e3167841a29a (diff)
downloadcmake-79a38073400e7e47696064af240de40e24257cf0.tar.gz
BUG: Fix FindBoost versioned find
To locate the boost include directory, all search paths and versioned path suffixes should be passed to one call of FIND_PATH. Previously the test for one version would find an unversioned system boost even when the user set BOOST_ROOT (since the NO_DEFAULT_PATH option is not used). See issue #7456.
Diffstat (limited to 'Modules/FindBoost.cmake')
-rw-r--r--Modules/FindBoost.cmake23
1 files changed, 13 insertions, 10 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 448707cdde..c0f09b28aa 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -286,8 +286,10 @@ ELSE (_boost_IN_CACHE)
# Try to find Boost by stepping backwards through the Boost versions
# we know about.
- FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
- IF( NOT Boost_INCLUDE_DIR )
+ IF( NOT Boost_INCLUDE_DIR )
+ # Build a list of path suffixes for each version.
+ SET(_boost_PATH_SUFFIXES)
+ FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
# Add in a path suffix, based on the required version, ideally
# we could read this from version.hpp, but for that to work we'd
# need to know the include dir already
@@ -304,15 +306,16 @@ ELSE (_boost_IN_CACHE)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
_boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
ENDIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
-
- FIND_PATH(Boost_INCLUDE_DIR
- NAMES boost/config.hpp
- HINTS ${_boost_INCLUDE_SEARCH_DIRS}
- PATH_SUFFIXES ${_boost_PATH_SUFFIX}
+ LIST(APPEND _boost_PATH_SUFFIXES "${_boost_PATH_SUFFIX}")
+ ENDFOREACH(_boost_VER)
+
+ # Look for a standard boost header file.
+ FIND_PATH(Boost_INCLUDE_DIR
+ NAMES boost/config.hpp
+ HINTS ${_boost_INCLUDE_SEARCH_DIRS}
+ PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
)
-
- ENDIF( NOT Boost_INCLUDE_DIR )
- ENDFOREACH(_boost_VER)
+ ENDIF( NOT Boost_INCLUDE_DIR )
IF(Boost_INCLUDE_DIR)
# Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp