From 9da1c33cf1613d2b5b8192c2cffefa87466b002f Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 30 Aug 2019 10:18:28 -0400 Subject: 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 --- Source/cmFileAPICodemodel.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 6025025..fecbf63 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; } -- cgit v0.12