<div dir="ltr">you'll need separate includes for dlopen thing, because you'll need the functions declares are pointers...<div><br></div><div>void (*f)( void );</div><div>or typedefed as functions</div><div>typedef void (*some_function_type)( void );</div><div>some_function_type f;<br></div><div><br></div><div>Or better include all those in a structure</div><div><br></div><div>struct dl_interface</div><div>{</div><div> void (*f)( void );</div><div>} lib_interface;</div><div><br></div><div>void Init(void )</div><div>{</div><div> int dl = dlopen( "lib", 0 );</div><div> lib_interface.f = dlsym( dl, "f" );</div><div>}</div><div><br></div><div>but none of that will be given by external headers.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 5, 2014 at 4:16 PM, Nils Gladitz <span dir="ltr"><<a href="mailto:nilsgladitz@gmail.com" target="_blank">nilsgladitz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 06.09.2014 00:44, Ted Middleton wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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:<br>
<br>
mylib/CMakeLists.txt:<br>
add_library( mylib SHARED src/mylibmain.c src/mylibsomething.c )<br>
target_include_directories( mylib PRIVATE src PUBLIC inc )<br>
target_link_libraries( mylib png )<br>
<br>
myexe/CMakeLists.txt:<br>
add_executable( myexe src/main.c src/stuff.c )<br>
target_include_directories( myexe PRIVATE src )<br>
target_link_libraries( myexe PRIVATE mylib )<br>
<br>
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:<br>
<br>
myexe/CMakeLists.txt:<br>
get_property( mylibincs TARGET mylib PROPERTY INTERFACE_INCLUDE_DIRECTORIES )<br>
add_executable( myexe src/main.c src/stuff.c )<br>
target_include_directories( myexe PRIVATE src ${mylibincs} )<br>
#target_link_libraries not necessary<br>
<br>
<br>
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()).<br>
</blockquote>
<br></div></div>
Try target_include_directories(<u></u>myexe PRIVATE $<TARGET_PROPERTY:mylib,<u></u>INTERFACE_INCLUDE_DIRECTORIES><u></u>)<br>
<br>
Nils<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/<u></u>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/<u></u>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/<u></u>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/<u></u>mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>