Hi,

   I am using the nice feature of exporting targets from one CMake project to 
another. This works really nicely since it avoids explicitly linking my 
executables and shared libraries with the dependent libraries of the imported 
library target. The problem is that imported library is linked with its full 
installation path using the value of property IMPORTED_LOCATION, which is 
generated when installing the exports. This implies that I cannot relocate the 
installation of the project that is exporting the targets. Is there a way to 
tell CMake to use only the library name for the imported library targets? 

  In other words and with a little example

add_library(bar SHARED IMPORTED)
set_property(TARGET bar APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties( bar PROPERTIES
  IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "A;B;C"
  IMPORTED_LOCATION_NOCONFIG "/tmp/absolute/path/to/libbar.so"
  IMPORTED_SONAME_NOCONFIG "libbar.so"
)
add_library(foo SHARED foo.cxx)
target_link_libraries(foo bar)

this gives the following link statement

Linking CXX shared library libfoo.so
/afs/cern.ch/sw/lcg/external/CMake/2.6.4/x86_64-slc5-gcc43-opt/bin/cmake -E 
cmake_link_script CMakeFiles/foo.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC   -shared -Wl,-soname,libfoo.so -o libfoo.so 
CMakeFiles/foo.dir/foo.o -L/tmp/absolute/path/to 
/tmp/absolute/path/to/libbar.so -lA -lB -lC -Wl,-rpath,/tmp/absolute/path/to

The question is how can I tell CMake to produce -lbar instead of 
/tmp/absolute/path/to/libbar.so?

I am using CMake version 2.6-patch 4.

-------------------------------------------------------------
Pere Mato  CERN, PH Department, CH 1211 Geneva 23, Switzerland
          e-mail: [email protected]      tel: +41 22 76 78696
          fax:  +41 22 76 68792            gsm: +41 76 48 70855


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to