diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2021-01-22 13:47:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-02 20:03:55 (GMT) |
commit | c450d66daa44c5314c84eb7252eb14a2dfd874a4 (patch) | |
tree | a0873cb5c5da7c29f0ef8f9b38fb8c28a39d4b13 /Source | |
parent | 9e2e96f5ada39fd3e688f59baf6cc5a8b65ed6e3 (diff) | |
download | CMake-c450d66daa44c5314c84eb7252eb14a2dfd874a4.zip CMake-c450d66daa44c5314c84eb7252eb14a2dfd874a4.tar.gz CMake-c450d66daa44c5314c84eb7252eb14a2dfd874a4.tar.bz2 |
PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 3 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 4 |
3 files changed, 22 insertions, 8 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 349b53b..3111911 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2610,16 +2610,25 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) } } - if (reuseTarget->GetType() != cmStateEnums::OBJECT_LIBRARY) { - std::string pchSourceObj = - reuseTarget->GetPchFileObject(config, lang, arch); - - // Link to the pch object file + // Link to the pch object file + std::string pchSourceObj = + reuseTarget->GetPchFileObject(config, lang, arch); + + if (target->GetType() != cmStateEnums::OBJECT_LIBRARY) { + std::string linkerProperty = "LINK_FLAGS_"; + if (target->GetType() == cmStateEnums::STATIC_LIBRARY) { + linkerProperty = "STATIC_LIBRARY_FLAGS_"; + } target->Target->AppendProperty( - cmStrCat("LINK_FLAGS_", configUpper), + cmStrCat(linkerProperty, configUpper), cmStrCat(" ", this->ConvertToOutputFormat(pchSourceObj, SHELL)), true); + } else { + target->Target->AppendProperty( + "INTERFACE_LINK_LIBRARIES", + cmStrCat("$<$<CONFIG:", config, + ">:$<LINK_ONLY:", pchSourceObj, ">>")); } } } else { @@ -2738,7 +2747,7 @@ void cmLocalGenerator::CopyPchCompilePdb( this->AddCustomCommandToTarget( target->GetName(), outputs, no_deps, commandLines, cmCustomCommandType::PRE_BUILD, no_message, no_current_dir, true, false, - "", "", false, cmObjectLibraryCommands::Reject, stdPipesUTF8); + "", "", false, cmObjectLibraryCommands::Accept, stdPipesUTF8); } else { cmImplicitDependsList no_implicit_depends; cmSourceFile* copy_rule = this->AddCustomCommandToOutput( diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index d2cdb99..97869c2 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1010,7 +1010,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( this->GetStaticLibraryFlags( libflags, configName, target->GetLinkerLanguage(configName), target); if (!libflags.empty()) { - fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; + fout << "\t\t\t\tAdditionalOptions=\"" << this->EscapeForXML(libflags) + << "\"\n"; } fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(libpath) << "\"/>\n"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index adf40b0..4918bf6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -815,6 +815,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // avoiding a trailing backslash in the argument. targetOutPathCompilePDB.back() = '/'; } + + std::string compilePdbOutputPath = + this->GeneratorTarget->GetCompilePDBDirectory(this->GetConfigName()); + cmSystemTools::MakeDirectory(compilePdbOutputPath); } cmRulePlaceholderExpander::RuleVariables vars; vars.CMTargetName = this->GeneratorTarget->GetName().c_str(); |