[CMake] Cmake error when adding Boost library

Daniel Sáez danst.18 at gmail.com
Fri Feb 20 13:19:01 EST 2015


Thank you Parag.

I realized that I was missing the following:

set(Boost_USE_STATIC_LIBS True)

And also I needed to set BOOST_ROOT instead of BOOST_INCLUDEDIR.

Regards,

Daniel


2015-02-20 17:20 GMT+00:00 Parag Chandra <parag at ionicsecurity.com>:

>   Hi Daniel,
>
>  I had some trouble with this myself a while back. You may want to refer
> to the Boost module documentation for some help:
>
>  http://www.cmake.org/cmake/help/v3.1/module/FindBoost.html
>
>  There are some additional flags you can set which will help CMake locate
> Boost for you; I’m sorry I don’t remember exactly which ones I set to
> locate it on Windows. In the end though, I needed to locate boost for many
> operating systems, so I compiled boost with system layout into individual
> configuration/architecture/operating system subdirectories, and then using
> the generic ‘find_library’ command.
>
>
>
> *Parag Chandra *Software Engineer, Mobile Team
> Mobile: +1.919.824.1410
>
>  <https://ionic.com>
>
> Ionic Security Inc.
> 1170 Peachtree St. NE STE 400, Atlanta, GA 30309
>
>
>
>
>
>
>
>
>   From: Daniel Sáez <danst.18 at gmail.com>
> Date: Friday, February 20, 2015 at 11:31 AM
> To: "cmake at cmake.org" <cmake at cmake.org>
> Subject: [CMake] Cmake error when adding Boost library
>
>    Hello,
>
> I am trying to add Boost library to my project using the CMakeLists.txt in
> the follwing way:
>
> set(BOOST_INCLUDEDIR "C:/boost_1_57_0")set(BOOST_LIBRARYDIR "C:/boost_1_57_0/stage/lib")
>
> find_package(Boost 1.57.0 COMPONENTS filesystem)
> include_directories(${Boost_INCLUDE_DIRS})
> add_executable(test test.cpp)
> target_link_libraries(test ${Boost_LIBRARIES})
>
>  However, I get the followng error: LINK : fatal error LNK1104: cannot
> open file 'libboost_filesystem-vc120-mt-1_57.lib'
>
> libboost_filesystem-vc120-mt-1_57.lib is located in the stage/lib folder,
> so I don't know what is going on. I am compiling with Visual Studio 2013.
>
> Any thoughts?
>
> Thank you,
>
> Daniel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150220/94ac5fe1/attachment.html>


More information about the CMake mailing list