[CMake] How to link the third party libraries into the project?
Alexander Neundorf
a.neundorf-work at gmx.net
Wed Jan 21 15:19:31 EST 2009
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
More information about the CMake
mailing list