[CMake] FindBoost

Philip Lowman philip at yhbt.com
Sat Apr 18 11:06:11 EDT 2009


On Sat, Apr 18, 2009 at 9:14 AM, Nadir SOUALEM <nadir.soualem at irisa.fr>wrote:

> Hi !!!
> Is there a way to avoid using TOUPPER
>
> SET(BOOST_ROOT $ENV{WORK}/../build/boost_1_34_1)
> SET(Boost_USE_MULTITHREAD ON)
> FIND_PACKAGE(Boost 1.34.1 COMPONENTS date_time filesystem)
>   STRING(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE)
> Message (lib= ${Boost_DATE_TIME_LIBRARY_${UPPER_CMAKE_BUILD_TYPE}} )
>
> I would like for example to use in debug mode, but
> CMAKE_BUILD_TYPE=Debug(documentation) not DEBUG
> and FindBoost use DEBUG (upperCase)  (DEBUG different of Debug in Unix
> case)


Use Boost_${COMPONENT}_LIBRARY instead.

This will include the "debug" and "optimized" keywords if both
Boost_${COMPONENT}_LIBRARY_DEBUG and Boost_${COMPONENT}_LIBRARY_RELEASE are
found.

You probably don't want to use CMAKE_BUILD_TYPE directly for this because
the debug libraries for boost aren't always readily available on non-Windows
platforms.  Also you may want to build with RelWithDebInfo or some other
build configuration in the future in which case the library would not be
found.

The documentation in the latest FindBoost no longer even mentions the _DEBUG
and _RELEASE variables and advises people to use either Boost_LIBRARIES or
Boost_${COMPONENT}_LIBRARY

# For each component you specify in find_package(), the following (UPPER-CASE)
# variables are set.  You can use these variables if you would like to pick and
# choose components for your targets instead of just using Boost_LIBRARIES.
#
#   Boost_${COMPONENT}_FOUND            True IF the Boost library
"component" was found.
#
#   Boost_${COMPONENT}_LIBRARY          Contains the libraries for the
specified Boost
#                                       "component" (includes debug
and optimized keywords
#                                       when needed).


-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090418/79f58d54/attachment.htm>


More information about the CMake mailing list