Let's try again... I submitted a question last week but got no responses so I have assumed my question and/or example was not explicit enough. I have stripped out all unnecessary structure from the code and am posing the question better (I hope)...
The functionality that I am using is expressed in this old bug: http://public.kitware.com/Bug/view.php?id=10395. I am adding dependencies in my project based on an imported library which is built by ExternalProject_add. Everything works but the linking is not as I would expect. I add my imported library like so (see code for ExternalProject_add statement): add_library(ExtLib SHARED IMPORTED) set_property(TARGET ExtLib PROPERTY IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/${EXT_LIB_NAME}") add_dependencies(ExtLib ExtLibBuild) I then link against this in my binary like so: add_executable(testApp testApp.cpp) target_link_libraries(testApp LINK_PUBLIC TestLib ExtLib) However, when I do this, the binray that comes out has a relative path to the 'ExtLib' which means I can only run it from the directory CMake builds it in. When I change the linking to be the below with the full path to ExtLib, it works just fine and I can run it from anywhere: target_link_libraries(testApp LINK_PUBLIC TestLib "${CMAKE_BINARY_DIR}/${EXT_LIB_NAME}") I gave the full path to the imported library in the "set_property..IMPORTED_LOCATION..." so I am unsure why the first one does not work? In this previous post from Brad in 2010 ( http://www.cmake.org/pipermail/cmake/2010-September/039639.html), it seems that the first way should work like I want, correct? A few other notes: * I have my RPATH properties set which has been a factor in getting this to work but I haven't tested enough to known which ones are actually helping or not. * The (more) SSCCE project is here: https://github.com/calebwherry/cmake-SO-question-main.git * I have also attached a tar'ed version. * System specs: Debian Wheezy 64-bit, CMake 3.0.2, GCC 4.9.2. Thanks, Caleb -- J. Caleb Wherry *Scientific Software Engineer* <http://www.calebwherry.com> http://www.calebwherry.com +1 (615) 708-5651 calebwhe...@gmail.com
cmake-SO-question-main.tar.gz
Description: GNU Zip compressed data
-- 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