[CMake] FindBoost.cmake oddities

Mike Jackson mike.jackson at bluequartz.net
Thu Dec 11 11:17:12 EST 2008


System: WinXP/ VS 2008 Express / CMake 2.6.2 / Boost 1.36.0 from BoostPro

Not sure what the intended behavior is here BUT I have ONLY installed 
static libraries on WinXP for Boost. When I run CMake using the 
following to find boost:

SET (Boost_FIND_REQUIRED TRUE)
SET (Boost_FIND_QUIETLY FALSE)
#SET (Boost_USE_STATIC_LIBS TRUE)
FIND_PACKAGE(Boost 1.36 COMPONENTS program_options system filesystem)

none of the libraries are found.

If I uncomment the SET (Boost_USE_STATIC_LIBS TRUE) line then the 
libraries are found.

Digging into the FindBoost.cmake module I see the following:

     # Support preference of static libs by adjusting 
CMAKE_FIND_LIBRARY_SUFFIXES
     IF( Boost_USE_STATIC_LIBS )
       SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES 
${CMAKE_FIND_LIBRARY_SUFFIXES})
       IF(WIN32)
         SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a 
${CMAKE_FIND_LIBRARY_SUFFIXES})
       ELSE(WIN32)
         SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
       ENDIF(WIN32)
     ENDIF( Boost_USE_STATIC_LIBS )

I thought that the Find_Library() command would find either static or 
dynamic all by itself without me having to force one or the other.

This doesn't seem "Correct" to me as I now have to _force_ my users to 
install a static only boost library?

Something doesn't add up with this. Anyone want to offer an explanation?

-------
Mike Jackson
BlueQuartz Software
www.bluequartz.net


More information about the CMake mailing list