[CMake] FindBoost.cmake updated on the bugtracker
Matthew Woehlke
mw_triad at users.sourceforge.net
Mon Mar 31 21:14:00 EDT 2008
Andreas Pakulat wrote:
> Hi,
>
> just wanted to let interested parties know that I've added a new version
> of FindBoost.cmake to bug #6257. It fixes a few bugs I still had in
> v2.
>
> I'd delete the existing versions, but unfortunately CMake's bugtracker
> doesn't allow to do that.
>
> Last but not least: Is there any chance of getting this into CMake
> 2.6.0? Or is it too late?
I cross-posted here with my own updates a few days ago, but only Andreas
replied last time.
I still have some issues with the current version (assuming it is the
same as the one in KDE's trunk), due to the prefix searching. I guess
this could be fixed by looping through the prefixes twice, once for
NO_DEFAULT_PATHS and once without. My solution was to assign two
different variables for each FIND_PATH type (with and without default
paths) and prefer anything found by NO_DEFAULT_PATHS.
I'm also not too sure about moving the check-for-the-right-version test
out from the find loop, but I guess that only breaks if a
NO_DEFAULT_PATHS install has no prefix and is older than an install that
would be found later, which is probably rare.
Here's my current diff:
$ svn di -x --ignore-all-space
Index: cmake/modules/FindBoost.cmake
===================================================================
--- cmake/modules/FindBoost.cmake (revision 792407)
+++ cmake/modules/FindBoost.cmake (working copy)
@@ -235,7 +235,6 @@
FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
- IF( NOT Boost_INCLUDE_DIR )
# 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
@@ -250,20 +249,25 @@
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]+")
-
#Prefer our include search paths
- 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
)
#If nothing is found search again using system default paths
- FIND_PATH(Boost_INCLUDE_DIR
+ FIND_PATH(Boost_FALLBACK_INCLUDE_DIR
NAMES boost/config.hpp
- PATHS ${_boost_INCLUDE_SEARCH_DIRS}
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
@@ -287,7 +291,6 @@
ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")
ENDIF(Boost_INCLUDE_DIR)
- ENDIF( NOT Boost_INCLUDE_DIR )
ENDFOREACH(_boost_VER)
#Setting some more suffixes for the library
--
Matthew
I think I want my tombstone to read:
<name>
Process created <date of birth>
Signal 15 received <date of death>
More information about the CMake
mailing list