[Cmake-commits] [cmake-commits] lowman committed FindBoost.cmake 1.17 1.18

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Jan 16 04:07:05 EST 2009


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv4048

Modified Files:
	FindBoost.cmake 
Log Message:
BUG: Fixed issues using FindBoost with BoostPro packaged releases.  Fixed
regression for bjam users on Win32 introduced in 1.4.2.4 (7/13/08).  This
commit partially or completely resolves Issues #8173, #8326, #7943, #7725!


Index: FindBoost.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/FindBoost.cmake,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** FindBoost.cmake	15 Jan 2009 07:07:03 -0000	1.17
--- FindBoost.cmake	16 Jan 2009 09:07:03 -0000	1.18
***************
*** 10,29 ****
  #     TARGET_LINK_LIBRARIES(foo ${Boost_LIBRARIES})
  #
- # The Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
- # boost version numbers that should be taken into account when searching
- # for the libraries. Unfortunately boost puts the version number into the
- # actual filename for the libraries, so this might be needed in the future
- # when new Boost versions are released.  CMake will one day have glob
- # or regex support for FIND_LIBRARY() after which this variable will
- # likely be removed.
- #
- # Currently this module searches for the following version numbers:
- # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, 1.36, 
- # 1.36.0, 1.36.1, 1.37
- #
  # The components list needs to be the actual names of boost libraries, that is
  # the part of the actual library files that differ on different libraries. So
  # its "date_time" for "libboost_date_time...". Anything else will result in
! # errors
  #
  # You can provide a minimum version number that should be used. If you provide this 
--- 10,17 ----
  #     TARGET_LINK_LIBRARIES(foo ${Boost_LIBRARIES})
  #
  # The components list needs to be the actual names of boost libraries, that is
  # the part of the actual library files that differ on different libraries. So
  # its "date_time" for "libboost_date_time...". Anything else will result in
! # errors.
  #
  # You can provide a minimum version number that should be used. If you provide this 
***************
*** 33,36 ****
--- 21,48 ----
  # to be specified in the Boost_ADDITIONAL_VERSIONS variable
  #
+ # =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
+ #
+ # OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
+ # boost version numbers that should be taken into account when searching
+ # for Boost. Unfortunately boost puts the version number into the
+ # actual filename for the libraries, so this variable will certainly be needed
+ # in the future when new Boost versions are released.  CMake will one day have glob
+ # or regex support for FIND_LIBRARY() after which this variable will
+ # likely be ignored.
+ #
+ # Currently this module searches for the following version numbers:
+ # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
+ # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0
+ #
+ # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
+ # add both 1.x and 1.x.0 as shown above.
+ #
+ # SET(Boost_ADDITIONAL_VERSIONS "0.99" "0.99.0" "1.78" "1.78.0")
+ #
+ # One day in the near future this will no longer be necessary and which
+ # version gets selected will depend completely on how you call FIND_PACKAGE().
+ #
+ # ============================================================================
+ #
  # Variables used by this module, they can change the default behaviour and need to be set
  # before calling find_package:
***************
*** 45,57 ****
  #
  #  Boost_ADDITIONAL_VERSIONS     A list of version numbers to use for searching
! #                                the boost include directory. The default list
! #                                of version numbers is:
! #                                1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 
! #                                1.35, 1.35.0, 1.35.1, 1.36, 1.36.0, 1.36.1,
! #                                1.37
! #                                If you want to look for an older or newer
! #                                version set this variable to a list of
! #                                strings, where each string contains a number, i.e.
! #                                SET(Boost_ADDITIONAL_VERSIONS "0.99.0" "1.35.0")
  #
  #  Boost_DEBUG                   Set this to TRUE to enable debugging output
--- 57,63 ----
  #
  #  Boost_ADDITIONAL_VERSIONS     A list of version numbers to use for searching
! #                                the boost include directory.  Please see
! #                                the documentation above regarding this
! #                                annoying variable :(
  #
  #  Boost_DEBUG                   Set this to TRUE to enable debugging output
***************
*** 137,141 ****
    # versions, find those that are acceptable to the user request.
    set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
!     "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
      "1.34" "1.33.1" "1.33.0" "1.33")
    set(_boost_TEST_VERSIONS)
--- 143,148 ----
    # versions, find those that are acceptable to the user request.
    set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
!     "1.37.0" "1.37"
!     "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
      "1.34" "1.33.1" "1.33.0" "1.33")
    set(_boost_TEST_VERSIONS)
***************
*** 287,304 ****
    SET(_boost_INCLUDE_SEARCH_DIRS
      C:/boost/include
!     "C:/boost"
!     "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}"
!     "$ENV{ProgramFiles}/Boost"
      /sw/local/include
    )
  
-   SET(_boost_LIBRARIES_SEARCH_DIRS
-     C:/boost/lib
-     "C:/boost"
-     "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}/lib"
-     "$ENV{ProgramFiles}/Boost"
-     /sw/local/lib
-   )
- 
    # If BOOST_ROOT was defined in the environment, use it.
    if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
--- 294,302 ----
    SET(_boost_INCLUDE_SEARCH_DIRS
      C:/boost/include
!     C:/boost
!     "$ENV{ProgramFiles}/boost"
      /sw/local/include
    )
  
    # If BOOST_ROOT was defined in the environment, use it.
    if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
***************
*** 315,323 ****
      set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
    ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
! 
    # If BOOST_LIBRARYDIR was defined in the environment, use it.
    IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
      set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
    ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
  
    if(Boost_DEBUG)
--- 313,325 ----
      set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
    ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
!   
    # If BOOST_LIBRARYDIR was defined in the environment, use it.
    IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
      set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
    ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
+   
+   IF( BOOST_ROOT )
+     file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
+   ENDIF( BOOST_ROOT )
  
    if(Boost_DEBUG)
***************
*** 335,347 ****
  
    IF( BOOST_ROOT )
-     file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
      SET(_boost_INCLUDE_SEARCH_DIRS 
        ${BOOST_ROOT}/include 
        ${BOOST_ROOT}
        ${_boost_INCLUDE_SEARCH_DIRS})
-     SET(_boost_LIBRARIES_SEARCH_DIRS 
-       ${BOOST_ROOT}/lib 
-       ${BOOST_ROOT}/stage/lib 
-       ${_boost_LIBRARIES_SEARCH_DIRS})
    ENDIF( BOOST_ROOT )
  
--- 337,344 ----
***************
*** 352,361 ****
    ENDIF( BOOST_INCLUDEDIR )
  
!   IF( BOOST_LIBRARYDIR )
!     file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
!     SET(_boost_LIBRARIES_SEARCH_DIRS 
!       ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS})
!   ENDIF( BOOST_LIBRARYDIR )
! 
    # Try to find Boost by stepping backwards through the Boost versions
    # we know about.
--- 349,355 ----
    ENDIF( BOOST_INCLUDEDIR )
  
!   # ------------------------------------------------------------------------
!   #  Search for Boost include DIR 
!   # ------------------------------------------------------------------------
    # Try to find Boost by stepping backwards through the Boost versions
    # we know about.
***************
*** 367,385 ****
        # we could read this from version.hpp, but for that to work we'd
        # need to know the include dir already
!       if (WIN32 AND NOT CYGWIN)
!         set(_boost_PATH_SUFFIX boost_${_boost_VER})
!       else (WIN32 AND NOT CYGWIN)
!         set(_boost_PATH_SUFFIX boost-${_boost_VER})
!       endif (WIN32 AND NOT CYGWIN)
  
!       IF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
            STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" 
!             _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
!       ELSEIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+")
            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]+")
        
!       LIST(APPEND _boost_PATH_SUFFIXES "${_boost_PATH_SUFFIX}")
      ENDFOREACH(_boost_VER)
        
--- 361,381 ----
        # we could read this from version.hpp, but for that to work we'd
        # need to know the include dir already
!       set(_boost_BOOSTIFIED_VERSION)
  
!       # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
!       IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
            STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" 
!             _boost_BOOSTIFIED_VERSION ${_boost_VER})
!       ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
            STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" 
!             _boost_BOOSTIFIED_VERSION ${_boost_VER})
!       ENDIF()
        
!       LIST(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
!       IF(WIN32)
!         # Yay Boost Pro!  We dig your underscores.
!         LIST(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
!       ENDIF()
! 
      ENDFOREACH(_boost_VER)
        
***************
*** 400,403 ****
--- 396,403 ----
        )
    ENDIF( NOT Boost_INCLUDE_DIR )
+   
+   # ------------------------------------------------------------------------
+   #  Extract version information from version.hpp
+   # ------------------------------------------------------------------------
  
    IF(Boost_INCLUDE_DIR)
***************
*** 408,411 ****
--- 408,415 ----
      SET(BOOST_LIB_VERSION "")
      FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
+     if(Boost_DEBUG)
+       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                      "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
+     endif()
    
      STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
***************
*** 432,435 ****
--- 436,443 ----
        "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
    ENDIF(Boost_INCLUDE_DIR)
+   
+   # ------------------------------------------------------------------------
+   #  Suffix initialization and compiler suffix detection.
+   # ------------------------------------------------------------------------
  
    # Setting some more suffixes for the library
***************
*** 534,537 ****
--- 542,566 ----
    #  Begin finding boost libraries
    # ------------------------------------------------------------------------
+   
+   SET(_boost_LIBRARIES_SEARCH_DIRS
+     C:/boost/lib
+     C:/boost
+     "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
+     "$ENV{ProgramFiles}/boost"
+     /sw/local/lib
+   )
+   IF( BOOST_ROOT )
+     SET(_boost_LIBRARIES_SEARCH_DIRS 
+       ${BOOST_ROOT}/lib 
+       ${BOOST_ROOT}/stage/lib 
+       ${_boost_LIBRARIES_SEARCH_DIRS})
+   ENDIF( BOOST_ROOT )
+ 
+   IF( BOOST_LIBRARYDIR )
+     file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
+     SET(_boost_LIBRARIES_SEARCH_DIRS 
+       ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS})
+   ENDIF( BOOST_LIBRARYDIR )
+ 
    if(Boost_DEBUG)
      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "



More information about the Cmake-commits mailing list