0

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.

tshepang
  • 12,111
  • 21
  • 91
  • 136
saiftyfirst
  • 111
  • 2
  • 7

2 Answers2

1

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.

Prashanth
  • 26
  • 5
0

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.