diff options
author | Brad King <brad.king@kitware.com> | 2019-08-30 10:18:28 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-08-30 10:20:12 -0400 |
commit | 9da1c33cf1613d2b5b8192c2cffefa87466b002f (patch) | |
tree | aa40ab1faf730619c5f80fc5e769913a4f0f8934 /Source | |
parent | 40bbe50e23c06232ccf1c49589dde5dd84e1ac31 (diff) | |
download | cmake-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.cxx | 6 |
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; } |