[CMake] How to link the third party libraries into the project?
Michael Jackson
mike.jackson at bluequartz.net
Wed Jan 21 15:27:32 EST 2009
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
More information about the CMake
mailing list