summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-08-30 10:18:28 -0400
committerBrad King <brad.king@kitware.com>2019-08-30 10:20:12 -0400
commit9da1c33cf1613d2b5b8192c2cffefa87466b002f (patch)
treeaa40ab1faf730619c5f80fc5e769913a4f0f8934 /Source
parent40bbe50e23c06232ccf1c49589dde5dd84e1ac31 (diff)
downloadcmake-9da1c33cf1613d2b5b8192c2cffefa87466b002f.tar.gz
fileapi: Fix codemodel v2 target file name for CMP0037 OLD behavior
With CMP0037 OLD behavior, executable and library target names may contain a slash. Avoid constructing file names with slashes. Fixes: #19653
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileAPICodemodel.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 6025025b03..fecbf63ca9 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -502,6 +502,12 @@ Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt,
{
Target t(gt, this->Config);
std::string prefix = "target-" + gt->GetName();
+ for (char& c : prefix) {
+ // CMP0037 OLD behavior allows slashes in target names. Remove them.
+ if (c == '/' || c == '\\') {
+ c = '_';
+ }
+ }
if (!this->Config.empty()) {
prefix += "-" + this->Config;
}