[CMake] Linking with boost

Lloyd lloydkl.tech at gmail.com
Fri Mar 14 00:33:54 EDT 2014


Hi,

Our project uses boost on Windows. Except thread library, all other library
need to be linked statically. To achieve this, what I did is this

ADD_DEFINITIONS(-D BOOST_THREAD_DYN_DLL)
set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)
find_package( Boost COMPONENTS thread system date_time regex filesystem
chrono)

As per boost documentation, in windows the static boost libraries are
started with the name "libboost*.lib" and the import libraries of dlls
start with "boost*".

If I turn ON or OFF  "Boost_USE_STATIC_LIBS", the value returned by

GET_FILENAME_COMPONENT(BFILESYS ${Boost_FILESYSTEM_LIBRARY_RELEASE} NAME_WE)

is always  "C:/Program
Files/boost_1_53_0/stage/lib/libboost_filesystem-vc100-mt-1_53.lib"

I was expecting that, if the Boost_USE_STATIC_LIBS is ON, the output to be
"*lib*boost_filesystem-vc100-mt-1_53.lib" and if the  Boost_USE_STATIC_LIBS
is OFF, the output to be "boost_filesystem-vc100-mt-1_53.lib".

Is anything going wrong here? Can anybody clarify this?

Thanks,
  Lloyd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140314/db0c06fd/attachment.html>


More information about the CMake mailing list