[CMake] FindBoost.cmake to find the boost libraries

Chauhan, Vikas vikas.chauhan at anritsu.com
Sun Jan 10 10:57:23 EST 2010


Hi all,

I am using the code below in cmakelists.txt to find the boost libraries
using cmake 2.8. 
After the execution "Boost_LIBRARIES" does not contain anything. Am I
correct in assuming that this variable must be populated with the list
of boost libraries?
Also, I am not sure how do I get the appropriate debug/release boost
libraries depending on the build configuration.
What are your thoughts on the FindBoost.cmake file located at the link
below (It was discussed in the mailing list in January 2008)?
http://www.cmake.org/pipermail/cmake/2008-January/019245.html

Thanks,
Vikas

------------------------------------------------------------------------
---------------------------------------------------
set(BOOST_ROOT "C:/Program Files/boost1.35.0")
set(Boost_DEBUG TRUE)
#search for BOOST
INCLUDE(${CMAKE_MODULE_PATH}/FindBoost.cmake)

IF (Boost_FOUND)
    #compare version strings 
    STRING (COMPARE LESS "${Boost_VERSION}" 1.35.0 VersionIncompatible)
    IF (VersionIncompatible)
        MESSAGE(FATAL_ERROR "Boost ${Boost_VERSION} not supported. 
        Only 1.35.0 version is supported.")
    ELSE (VersionIncompatible)
        MESSAGE (STATUS "Found Boost ${Boost_VERSION} --
${Boost_LIBRARIES}")
        INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
        SET(requiredLibs ${requiredLibs} ${Boost_LIBRARIES})
    ENDIF (VersionIncompatible)
ELSE (Boost_FOUND)
    MESSAGE (STATUS "Boost NOT FOUND")
ENDIF (Boost_FOUND)

------------------------------------------------------------------------
-------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100110/c52a98f2/attachment.htm>


More information about the CMake mailing list