saiftyfirst
saiftyfirst

Reputation: 111

CMake linking to external project

I am new to cmake and want to use the following external project in my program. (https://github.com/mfontanini/cppkafka) The idea is to download from git and build using cmake, which I have managed already. At the end of it, I am left with a .so file which I then have to link back to the main project. Any ideas on how I can achieve this ? Also, would like some suggestion on how to manage dependencies in a project with cmake that would possibly be carried forward to production.

Upvotes: 0

Views: 442

Answers (2)

Prashanth
Prashanth

Reputation: 26

Use ADD_SUBDIRECTORY to add the external project to your project. Then you can use the named tragets from this project while linking with TARGET_LINK_LIBRARIES.

Upvotes: 1

Aurélien Foucault
Aurélien Foucault

Reputation: 559

You can use the ExternalProject of cmake.

External project are downloaded in ${CMAKE_CURRENT_BINARY_DIR}/third-party

You can perform actions on them as target.

Upvotes: 0

Related Questions