Hi, In general, relative parameters of type PATH, like "lib" or
"source/include" are resolved to an absolute path using current value
of variables, like for instance: ${CMAKE_INSTALL_PREFIX} in case of command
INSTALL(). This, however, does not work if I would like to use empty relative
path (or not set it at all), so that the resulting absolute path was equal to
${CMAKE_INSTALL_PREFIX} - cmake generator would complain about non existing
DESTINATION, although there is no reason why it couldn't be resolved. I
know two workarounds to this issue, but the both have their flaws which prevent
me from achieving my goal: 1. Use ${CMAKE_INSTALL_PREFIX} as the DESTINATION
value. This correctly resolved the path, but in case of INSTALL(EXPORT), paths
in generated Target.cmake are absolute, which makes the package not
relocatable. 2. Use '.' as the DESTINATION. This at least generates
relative paths inside Target.cmake, but the paths are incorrect. '.' is
apparently considered as a regular folder, and in the process of Target.cmake
generation, when _IMPORT_PREFIX is determined, cmake strips one folder
component too much: # Compute the installation prefix relative to this file.
get_filename_component(_IMPORT "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT "${_IMPORT_PREFIX}" PATH) Do you know
any other workaround? Do you think that lack of empty relative paths could be
considered a bug? Piotr
--
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