mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-21 06:30:20 -06:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user