Hi, it would be nice to know if the usage of add_library(foo SHARED IMPORTED) is the way to go in this case.
find_package() seems to be useless, as it requires that the external library is already present when cmake is invoked, which is not the case with an external project. So it seems like I have to define everything via set_target_properies(). What I see is that cmake uses rpath for linking using gcc/binutils. Is there a way to just use -L here? In the final installation (an embedded device), the libraries will be placed in the standard search path of the dynamic linker, so the rpath is just build system specific and not needed for the resulting binary. I also discovered that the build of the external project is not updated when the filesystem timestamp as well as the contents of external.tar.gz were changed. How can I achieve this? Here is my minimized example: cmake_minimum_required(VERSION 3.0.0) project (hello) add_executable(hello helloworld.cpp) include(ExternalProject) ExternalProject_Add(externalproject URL ../../../external.tar.gz) ExternalProject_Get_Property(externalproject binary_dir) add_library(externallib SHARED IMPORTED) set_target_properties(externallib PROPERTIES IMPORTED_LOCATION ${binary_dir}/install/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mylib${CMAKE_SHARED_LIBRARY_SUFFIX} ) include_directories(${binary_dir}/install/include/) target_link_libraries(hello externallib) add_dependencies(hello externalproject) Regards, Tino -- 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