[CMake] Shared library from ExternalProject

Tino Mettler tino.mettler at alcnetworx.de
Wed Sep 9 08:58:21 EDT 2015


Hi,

I'm thinking about a solution to use separate projects as source
archives and include it into the main cmake build.

I looks like ExternalProject_Add() can handle this. However, there seems
to be no standard way to use shared C/C++ libraries in an external
project. Is there a basic example how to handle things like compiler and
linker flags, dependencies etc. for let's say, an external project
called foo and a library libbar.so?

My understanding is that I need to define a shared library using
"add_library(bar SHARED IMPORTED)" and use set_target_properties() to
adjust the location. What else do I need to do? My guess is that I need
to build a config.cmake in the external project and use find_package(),
but I'm not sure about that.

Regards,
Tino





More information about the CMake mailing list