[CMake] Target_link_libraries imported library

Lars laasunde at hotmail.com
Wed May 13 09:19:41 EDT 2015


Hello,
 
We have an internal software product foo which is exported.
 
A typical component:
add_library(foo_library SHARED ...)
target_link_libraries(foo_library 
  foo_common 
  foo_comp
  ${Boost_LIBRARIES})
 
When building the exported package a file name FooDepends-release.cmake is produced which contains;
set_target_properties(foo_library PROPERTIES
  IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/foo_library.lib"
  IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "foo_common;foo_comp;c:\boost\lib\boost_filesystem-vc110-mt-1_55.lib;")
 
In another software product we use Find_Package command to find foo. Linking also works;
add_library(bar-library SHARED ...)
target_link_libraries(bar-library
  foo_library
  ${Boost_LIBRARIES})
 
There is one problem with this setup and that is the IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE contains a static path to a boost lib. So the "c:\boost\lib\boost_filesystem-vc110-mt-1_55.lib" is appended to the linking of "bar-library" and this will fail if the path is incorrect. We cannot guarantee that boost is located at the same path on all Windows system. So how can we remove or update the boost path?
Using CMake 2.8.12 on Windows 7.
 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150513/76a55869/attachment.html>


More information about the CMake mailing list