Just wondering if there's a nice way of getting a library target's includes
but not linking to it, so I can use dlopen() on it instead. If I want to
build a shared library that gets implicitly loaded by an executable, I
would do this:
mylib/CMakeLists.txt:
add_library( mylib SHARED src/mylibmain.c src/mylibsomething.c )
target_include_directories( mylib PRIVATE src PUBLIC inc )
target_link_libraries( mylib png )
myexe/CMakeLists.txt:
add_executable( myexe src/main.c src/stuff.c )
target_include_directories( myexe PRIVATE src )
target_link_libraries( myexe PRIVATE mylib )
What I really want, though, is for mylib's public include dir to be
accessible to myexe, but I don't want myexe to link to mylib - I'm going to
load it with dlopen()/LoadLibrary(). Do I have to do something like this:
myexe/CMakeLists.txt:
get_property( mylibincs TARGET mylib PROPERTY
INTERFACE_INCLUDE_DIRECTORIES )
add_executable( myexe src/main.c src/stuff.c )
target_include_directories( myexe PRIVATE src ${mylibincs} )
#target_link_libraries not necessary
This must be really simple, but I can't seem to find anything about it on
the cmake wikis or through google. There's a very old post from 2006 or so
(pre target properties, it uses include_directories()).
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake