Skip to content

Make export config file relocatable

NOTE: The latest tag you gave me is not on any branch ! I assume @mavogel has just pushed the tag and not the branch he worked on. If you delete the tag, gitlab will garbage collect the commits beyond the current head of release-5.0-CR1 at some point in the future.

Please do not accept blindly as I gave release-5.0-CR1 as target branch and there are many changes I don't expect. This should be against a branch that corresponds to yesterday's tag that Marcelo gave me.

The changes here are:

  1. Get rid of all absolute path names (by removing $CMAKE_INSTALL_PREFIX path and using relative paths). The install() command calculates the locations based on CMAKE_INSTALL_PREFIX anyway.
  2. Use a standard cmake helper module to generate a relocatable config file that can be consumed by clients. Again this allows to remove all use of the CMAKE_INSTALL_PREFIX variable and simply have the locations calculated at run-time.
  3. Finally I changed the check if CMAKE_INSTALL_PREFIX is set to the recommended way by checking a variable which exists for that purpose instead of comparing to /usr/local.

With these changes we can use your exported target directly via

find_package(CrestApiLib REQUIRED)
target_link_library(sometarget PRIVATE CrestApiLib::CrestApiLib)
Edited by Reiner Hauser

Merge request reports

Loading