[CMake] cmake and boost

Nehme Bilal nbilal at mirarco.org
Fri Mar 19 16:51:49 EDT 2010


Sorry I did some mistakes. The error I am getting is:
LINK : fatal error LNK1104: cannot open file 
'libboost_date_time-vc100-mt-gd-1_41.lib'

and visual studio is trying to look for "vc100" instead of 
"vc"


On Fri, 19 Mar 2010 16:49:24 -0400
  "Nehme Bilal" <nbilal at mirarco.org> wrote:
> Thanks all for your responses !
> 
> I tried James C. Sutherland solution and modified my 
>CMakeList like this:
> ############################################################
> cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
> 
> include_directories(${CMAKE_SOURCE_DIR}/boost/src)
> 
> include( 
>${CMAKE_SOURCE_DIR}/boost/build/lib/Exports.cmake )
> 	
> add_executable(my_program main.cpp)
> 
> target_link_libraries(my_program 
>boost_date_time-mt-shared)
> ############################################################
> 
> it worked but when I try to :
> #include "boost/date_time/posix_time/time_parsers.hpp"
> 
> I get this error:
> libboost_date_time-vc100-mt-gd-1_41.lib
> 
> in boost\build\lib\Debug, I have:
> libboost_date_time-vc-mt-gd-1_41.lib
> 
> Why is visual studio trying to look for "vc" instead of 
>"vc100" ?
> 
> for the other proposed solutions, am not sure I 
>understand how to do it correctly because I don't know 
>cmake that well. can you modify my CMakeList and add what 
>you are proposing ?
> 
> Thanks.
> Nehme
> 
> 
> On Fri, 19 Mar 2010 15:43:53 -0400
>  Michael Jackson <mike.jackson at bluequartz.net> wrote:
>> 
>> On Mar 19, 2010, at 3:34 PM, James C. Sutherland wrote:
>> 
>>>>
>>>> Why not just let the user decide where they'd like to 
>>>>get boost, and simplify your build system by just using 
>>>>find_package(Boost)?
>>>>
>>>> For example, this is all you need for a simple 
>>>>boost-using app...
>>>>
>>>> find_package(Boost 1.34.0 REQUIRED COMPONENTS filesystem 
>>>>system)
>>>> include_directories(${Boost_INCLUDE_DIR})
>>>> add_executable(yourapp yourapp.cpp)
>>>> target_link_libraries(yourapp ${Boost_LIBRARIES})
>>>>
>>> Indeed this is the best approach, although it isn't 
>>>quite that straightforward in all cases since the 
>>>FindBoost.cmake module functions a bit differently with 
>>>the CMake installation than it does with the bjam 
>>>installation.  For example, I do something like:
>>>
>>> if( BOOST_CMAKE )
>>>   set(Boost_USE_STATIC ON)
>>>   find_package( Boost REQUIRED COMPONENTS ${boost_comps} 
>>>NO_MODULE )
>>> else()
>>>   set(Boost_USE_STATIC_LIBS ON)
>>>   find_package( Boost REQUIRED COMPONENTS ${boost_comps} 
>>>)
>>> endif()
>>>
>>> where I define BOOST_CMAKE if I have a cmake-based boost 
>>>installation.
>> 
>> Hmm, I don't have to do any of that for my Boost-Cmake 
>>installation. There is a "trick" to configuring the 
>>Boost_CMake build so that it has the same layout as a 
>>bjam built boost.
>> 
>> ___________________________________________________________
>> Mike Jackson                      www.bluequartz.net
>> Principal Software Engineer 
>>     mike.jackson at bluequartz.net
>> BlueQuartz Software               Dayton, Ohio
>> 
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at 
>>http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ 
>>at: http://www.cmake.org/Wiki/CMake_FAQ
>> 
>>Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
> 



More information about the CMake mailing list