When install(EXPORT) is given an absolute destination we cannot compute the install prefix relative to the installed export file location. Previously we disallowed installation of targets in such exports with a relative destination, but did not enforce this for target property values besides the location of the main target file. This could lead to broken installations when the EXPORT is installed to an absolute path but usage requirements are specified relative to the install prefix. Since an EXPORT installed to an absolute destination cannot be relocated we can just hard-code the value of CMAKE_INSTALL_PREFIX as the base for relative paths. This will allow absolute install(EXPORT) destinations to work with relative destinations for targets and usage requirements. Extend the ExportImport test with a case covering this behavior.
10 lines
430 B
ReStructuredText
10 lines
430 B
ReStructuredText
install-EXPORT-absolute-prefix
|
|
------------------------------
|
|
|
|
* The :command:`install(EXPORT)` command now works with an absolute
|
|
``DESTINATION`` even if targets in the export set are installed
|
|
with a destination or usage requirements specified relative to the
|
|
install prefix. The value of the :variable:`CMAKE_INSTALL_PREFIX`
|
|
variable is hard-coded into the installed export file as the base
|
|
for relative references.
|