summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-05-01 13:28:59 (GMT)
committerBrad King <brad.king@kitware.com>2024-05-01 13:28:59 (GMT)
commitf909fc2f92a78c8bbf73180edf0b81aba69d4467 (patch)
tree6ca1614559a4787037c0f5bb87056cd697869c77 /Source/cmGeneratorTarget.cxx
parentc7d260f9b7ffd31d4d0f6ce483470e5e5cec73f9 (diff)
parent142a85f9c17ae8266168eb8eb2e1c9dfb76f876e (diff)
downloadCMake-f909fc2f92a78c8bbf73180edf0b81aba69d4467.zip
CMake-f909fc2f92a78c8bbf73180edf0b81aba69d4467.tar.gz
CMake-f909fc2f92a78c8bbf73180edf0b81aba69d4467.tar.bz2
Merge topic 'export-name-safe-name' into release-3.28
142a85f9c1 cxxmodules: use filesystem-safe export names in filenames 4452d41488 cmGeneratorTarget: add method to get a filesystem-safe export name Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9474
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a2ceeb4..332098e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -367,6 +367,16 @@ std::string cmGeneratorTarget::GetExportName() const
return this->GetName();
}
+std::string cmGeneratorTarget::GetFilesystemExportName() const
+{
+ auto fs_safe = this->GetExportName();
+ // First escape any `_` characters to avoid collisions.
+ cmSystemTools::ReplaceString(fs_safe, "_", "__");
+ // Escape other characters that are not generally filesystem-safe.
+ cmSystemTools::ReplaceString(fs_safe, ":", "_c");
+ return fs_safe;
+}
+
cmValue cmGeneratorTarget::GetProperty(const std::string& prop) const
{
if (cmValue result =