Making FindBoost prefer Boost_ROOT
Matthew Woehlke
mw_triad at users.sourceforge.net
Wed Mar 26 22:15:30 GMT 2008
In order to get my Boost_ROOT honored rather than the system boost in
/usr/include (which is too old), I had to make the following changes to
FindBoost.cmake (this is from kdevplatform, but I've had to copy the
module to pimlibs and now kdesdk also, due to the module from cmake
2.4.6 being similarly inadequate). Should I commit this?
CC'ing also the cmake list, as I'm not sure what to do about this as far
as upstream; maybe someone will have comments.
(I suppose an ideal refinement would be to search Boost_ROOT first, then
the normal paths, then any extra paths... but that's a bigger change.
Let me know if it's preferred, though.)
Index: cmake/modules/FindBoost.cmake
===================================================================
--- cmake/modules/FindBoost.cmake (revision 790531)
+++ cmake/modules/FindBoost.cmake (working copy)
@@ -245,11 +245,23 @@
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
"\\1_\\2_\\3" _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
- FIND_PATH(Boost_INCLUDE_DIR
+ FIND_PATH(Boost_PREFERRED_INCLUDE_DIR
NAMES boost/config.hpp
PATHS ${_boost_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${_boost_PATH_SUFFIX}
+ NO_DEFAULT_PATH
)
+ FIND_PATH(Boost_FALLBACK_INCLUDE_DIR
+ NAMES boost/config.hpp
+ PATH_SUFFIXES ${_boost_PATH_SUFFIX}
+ )
+ IF(Boost_PREFERRED_INCLUDE_DIR)
+ SET(Boost_INCLUDE_DIR ${Boost_PREFERRED_INCLUDE_DIR})
+ ELSEIF(Boost_FALLBACK_INCLUDE_DIR)
+ SET(Boost_INCLUDE_DIR ${Boost_FALLBACK_INCLUDE_DIR})
+ ELSE(Boost_PREFERRED_INCLUDE_DIR)
+ SET(Boost_INCLUDE_DIR Boost_INCLUDE_DIR-NOTFOUND)
+ ENDIF(Boost_PREFERRED_INCLUDE_DIR)
IF(Boost_INCLUDE_DIR)
# Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
--
Matthew
I'm anti-ascii. Probably because I once worked with a guy who sent EVERY
BLOODY DESIGN SCHEMA as an ascii art thing. A year into that job and I
just about wanted to punch him in the head with an ascii fist. He
totally ruined ascii porn for me even. -- Aaron Seigo
More information about the kde-core-devel
mailing list