[CMake] How to exclude linking from add_subdirectory?

kipade kipade at 163.com
Sat Mar 25 00:58:41 EDT 2017


In my cmake project, there are some subdirectories within it, and some of them have to build as completed 
static or shared libraries.
1. The top project is executable 
2. a subdirectory is a shared project, which also have some subdirectoy compile as static libraries which
   of course should ONLY link into their parent shared library
I add link options to linking the shared library produced by its subdirectory(which linked as a shared library), 
but I found the all sub-static library with the shared library project(the subdirectory) also double linked into
the top executable project. Of course I only want to link the shared library. How to resolve such problem 
for the top CMakeLists.txt?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170325/9112c14f/attachment.html>


More information about the CMake mailing list