Hi,

I'm trying to get my head around CMake config files to use in combination
with find_package.
So currently I have a given library target setup.

Then I call a configure_package_config_file to generate some
TargetConfig.cmake.
After that I call an export on the target.

The files are generated fine, and it looks fine, except for one thing,
which is that the libraries it imports use absolute paths.
The export command generates the cmake file which imports targets, but it
does it like this, using absolute paths:

set_target_properties(MCore PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
  IMPORTED_LOCATION_PROFILE *"C:/Test/Lib/MCore_Debug.lib"*
  )

As I cannot ship the config files using absolute paths I need to make them
use relative paths. However I cannot get the export command to output a
relative path.

Does anyone know how I should do this? Or using some prefix variable and
then relative to that.

I currently export like this:
--------------
configure_package_config_file( "MCoreConfig.cmake.in"
"${CMAKE_BINARY_DIR}/MCoreConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS INCLUDE_DIR CONF_RELATIVE_DIR CUSTOM_ROOT)

export( TARGETS MCore FILE "${CMAKE_BINARY_DIR}/MCoreTargets.cmake" )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MCoreConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/MCoreTargets.cmake" DESTINATION
"${CUSTOM_ROOT}/CMake" )
-----------
I basically need everything relative to the ${CUSTOM_ROOT} folder.

Any hints/help would be appreciated :)

Thanks,
- John
-- 

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

Reply via email to