[CMake] How to link the third party libraries into the project?

Michael Jackson mike.jackson at bluequartz.net
Thu Jan 22 08:55:41 EST 2009


You have a mix of boost libraries built with VS2005 (VC8) and VS2008  
(VC9). You are compiling your program with VS2008 but only have the  
appropriate libraries for VS2005 for the specific library requested.  
You need to build/install the proper libraries for VS 2008.
   With visual studio you can not mix libraries from one compiler to  
another compiler.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Jan 22, 2009, at 7:18 AM, Ram Mulage wrote:

> Hi Adam,
>
> I have used the FindBoost.cmake and now am able to find the boost  
> library(include and libs) but I have a linking problem. I am using  
> the Boost_1_35 and in that am using several libriries including  
> Boost::thread. I am getting the linker error for the Boost::thread;  
> On my disk I have the below mentioned lib files
>
> libboost_thread-vc80-mt-1_35.lib
> libboost_thread-vc80-mt-gd-1_35.lib
> libboost_thread-vc80-mt-s-1_35.lib
> libboost_thread-vc80-mt-sgd-1_35.lib
> libboost_thread-vc90-mt-s-1_35.lib
> libboost_thread-vc90-mt-sgd-1_35.lib
>
> but the NMake is searching for 'libboost_thread-vc90-mt- 
> gd-1_35.lib', which is not present. What could be the reason?
>
> Thanks for your help in advance.
>
> Regards,
> -Ram
>
>
>
> On Wed, Jan 21, 2009 at 8:44 PM, Adam Weiss <cseadam 
> +cmake at gmail.com> wrote:
> On Wed, Jan 21, 2009 at 3:27 PM, Michael Jackson
> <mike.jackson at bluequartz.net> wrote:
> >
> > On Jan 21, 2009, at 3:19 PM, Alexander Neundorf wrote:
> >
> >> On Wednesday 21 January 2009, Ram Mulage wrote:
> >>>
> >>> Hi All,
> >>>
> >>> I am using boost library in my project and I want to link the  
> boost
> >>> static
> >>> libraries into my project. How do i do this?
> >>>
> >>> My project  directory looks as below and each of the directories  
> has the
> >>> CMakeLists.txt file.
> >>>
> >>> Project
> >>>
> >>>  |-Lib1
> >>>  |-Lib2
> >>>  |-Application
> >>>
> >>> I am using the some of the boost libraries in the 'Application'  
> directory
> >>> apart from the Lib1 and Lib2 and the exe is built in Application
> >>> directory
> >>> itself. The boost librariess and the boost headers are present
> >>> 'C:/Users/Admin/Boost/lib/windows' and 'C:/Users/Admin/Boost/ 
> boost'.
> >>> Could
> >>> you please tell how my CMakeList.txt for 'Application' directory  
> should
> >>> look?
> >>>
> >>> I would appreciate any help in this regard.
> >>
> >> Please have a look at the FindBoost.cmake module documentation, you
> >> probably
> >> want to use it.
> >> I haven't used Boost with cmake yet, but it should be more or  
> less the
> >> same as
> >> for other packages:
> >>
> >> # make cmake search for the package:
> >> find_package(Foo REQUIRED)
> >>
> >> # add the include directories:
> >> include_directories(${FOO_INCLUDE_DIRS})
> >>
> >> # add targets etc.
> >> add_executable(hello main.cpp)
> >>
> >> # link to the necessary libraries
> >> target_link_libraries(hello ${FOO_LIBRARIES})
> >>
> >> Alex
> >>
> >
> > I have a gut feeling just looking at where his install is located  
> and the
> > include directory that the standard Find_Package(Boost) is NOT  
> going to
> > work.. but give it a try and let's see what happens.
> >
> > Mike
> >
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake
> >
>
>
> As the module says:
>
> # Variables used by this module, they can change the default behaviour
> and need to be set
> # before calling find_package:
> #  Boost_USE_MULTITHREAD         Can be set to OFF to use the non- 
> multithreaded
> #                                boost libraries. Defaults to ON.
> #  Boost_USE_STATIC_LIBS         Can be set to ON to force the use  
> of the static
> #                                boost libraries. Defaults to OFF.
> #  Boost_ADDITIONAL_VERSIONS     A list of version numbers to use  
> for searching
> #                                the boost include directory. The  
> default list
> #                                of version numbers is:
> #                                1.33, 1.33.0, 1.33.1, 1.34, 1.34.0,  
> 1.34.1,
> #                                1.35, 1.35.0, 1.35.1, 1.36.0, 1.36.1
> #                                If you want to look for an older or  
> newer
> #                                version set this variable to a list  
> of
> #                                strings, where each string contains a
> number, i.e.
> #                                SET(Boost_ADDITIONAL_VERSIONS
> "0.99.0" "1.35.0")
> #  BOOST_ROOT                    Preferred installation prefix for
> searching for Boost,
> #                                set this if the module has problems
> finding the proper Boost installation
> #  BOOST_INCLUDEDIR              Set this to the include directory of
> Boost, if the
> #                                module has problems finding the
> proper Boost installation
> #  BOOST_LIBRARYDIR              Set this to the lib directory of  
> Boost, if the
> #                                module has problems finding the
> proper Boost installation
> #
> #  The last three variables are available also as environment  
> variables
>
>
> Following this, there should be no problem getting  
> Find_Package(Boost) to work.
>
> -Adam
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>



More information about the CMake mailing list