diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-06-19 15:49:38 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-06-20 15:39:11 (GMT) |
commit | 70f36de1e54e072cc3f241f7d1fe8333aad2296e (patch) | |
tree | c9bb4f2e9e81b65a680a83a05e852099e17d72f5 /Source | |
parent | 9eccac530c28df41be893d6cfcab2a88762c034b (diff) | |
download | CMake-70f36de1e54e072cc3f241f7d1fe8333aad2296e.zip CMake-70f36de1e54e072cc3f241f7d1fe8333aad2296e.tar.gz CMake-70f36de1e54e072cc3f241f7d1fe8333aad2296e.tar.bz2 |
File set: Allow absolute CMAKE_INSTALL_INCLUDEDIR
When install(TARGETS) and install(EXPORT) were called with file sets
and an absolute CMAKE_INSTALL_INCLUDEDIR, "${_IMPORT_PREFIX}/" was
still being prepended to the base directory and files, resulting in
incorrect paths. Don't prepend this when absolute paths are used.
Fixes: #25010
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 538c883..46cd936 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -590,10 +590,12 @@ std::string cmExportInstallFileGenerator::GetFileSetDirectories( auto cge = ge.Parse(te->FileSetGenerators.at(fileSet)->GetDestination()); for (auto const& config : configs) { - auto dest = cmStrCat("${_IMPORT_PREFIX}/", - cmOutputConverter::EscapeForCMake( - cge->Evaluate(gte->LocalGenerator, config, gte), - cmOutputConverter::WrapQuotes::NoWrap)); + auto unescapedDest = cge->Evaluate(gte->LocalGenerator, config, gte); + auto dest = cmOutputConverter::EscapeForCMake( + unescapedDest, cmOutputConverter::WrapQuotes::NoWrap); + if (!cmSystemTools::FileIsFullPath(unescapedDest)) { + dest = cmStrCat("${_IMPORT_PREFIX}/", dest); + } auto const& type = fileSet->GetType(); // C++ modules do not support interface file sets which are dependent upon @@ -645,11 +647,14 @@ std::string cmExportInstallFileGenerator::GetFileSetFiles( fileSet->EvaluateFileEntry(directories, files, entry, gte->LocalGenerator, config, gte); } - auto dest = cmStrCat("${_IMPORT_PREFIX}/", - cmOutputConverter::EscapeForCMake( - destCge->Evaluate(gte->LocalGenerator, config, gte), - cmOutputConverter::WrapQuotes::NoWrap), - '/'); + auto unescapedDest = destCge->Evaluate(gte->LocalGenerator, config, gte); + auto dest = + cmStrCat(cmOutputConverter::EscapeForCMake( + unescapedDest, cmOutputConverter::WrapQuotes::NoWrap), + '/'); + if (!cmSystemTools::FileIsFullPath(unescapedDest)) { + dest = cmStrCat("${_IMPORT_PREFIX}/", dest); + } bool const contextSensitive = destCge->GetHadContextSensitiveCondition() || std::any_of(directoryEntries.begin(), directoryEntries.end(), |