[CMake] FindBoost.cmake oddities

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


Up a bit further I see the culprit:

   IF ( WIN32 AND Boost_USE_STATIC_LIBS )
     SET (Boost_LIB_PREFIX "lib")
   ENDIF ( WIN32 AND Boost_USE_STATIC_LIBS )

So I guess I need some logic in my own cmake files that says if Boost 
was NOT found, set Boost_USE_STATIC_LIBS to TRUE and try again, only if 
we are on Win32. I am sure I am missing something simple...

Mike


Mike Jackson wrote:
> 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