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.
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
.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.