diff options
author | Brad King <brad.king@kitware.com> | 2023-10-19 13:33:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-10-19 13:34:10 (GMT) |
commit | 43826dccc81c0ec29eae15ce8f7e3ed6b8d629df (patch) | |
tree | b8b963468a5167f71164a09c1088f1597e1ba09a | |
parent | d5e030fa67682be307e7d0415caf3956e5a2b353 (diff) | |
parent | 67ddca187cc96b805060fc6d1a140814968ebe39 (diff) | |
download | CMake-43826dccc81c0ec29eae15ce8f7e3ed6b8d629df.zip CMake-43826dccc81c0ec29eae15ce8f7e3ed6b8d629df.tar.gz CMake-43826dccc81c0ec29eae15ce8f7e3ed6b8d629df.tar.bz2 |
Merge topic 'ninja_compile_commands'
67ddca187c Ninja: Set TARGET_COMPILE_PDB correctly for compile_commands.json
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8897
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 17 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.h | 1 |
2 files changed, 12 insertions, 6 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 0bda945..a93f9c9 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1409,10 +1409,13 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( } } + this->SetMsvcTargetPdbVariable(vars, config); + if (firstForConfig) { this->ExportObjectCompileCommand( language, sourceFilePath, objectDir, objectFileName, objectFileDir, - vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config); + vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], + vars["TARGET_COMPILE_PDB"], vars["TARGET_PDB"], config); } objBuild.Outputs.push_back(objectFileName); @@ -1607,8 +1610,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( } } - this->SetMsvcTargetPdbVariable(vars, config); - objBuild.RspFile = cmStrCat(objectFileName, ".rsp"); if (language == "ISPC") { @@ -1759,10 +1760,13 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement( vars["CLANG_TIDY_EXPORT_FIXES"] = fixesFile; } + this->SetMsvcTargetPdbVariable(vars, config); + if (firstForConfig) { this->ExportObjectCompileCommand( language, sourceFilePath, bmiDir, bmiFileName, bmiFileDir, vars["FLAGS"], - vars["DEFINES"], vars["INCLUDES"], config); + vars["DEFINES"], vars["INCLUDES"], vars["TARGET_COMPILE_PDB"], + vars["TARGET_PDB"], config); } bmiBuild.Outputs.push_back(bmiFileName); @@ -1833,8 +1837,6 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement( this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(), vars); - this->SetMsvcTargetPdbVariable(vars, config); - bmiBuild.RspFile = cmStrCat(bmiFileName, ".rsp"); this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), @@ -1966,6 +1968,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( std::string const& objectDir, std::string const& objectFileName, std::string const& objectFileDir, std::string const& flags, std::string const& defines, std::string const& includes, + std::string const& targetCompilePdb, std::string const& targetPdb, std::string const& outputConfig) { if (!this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS")) { @@ -2016,6 +2019,8 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( compileObjectVars.Flags = fullFlags.c_str(); compileObjectVars.Defines = defines.c_str(); compileObjectVars.Includes = includes.c_str(); + compileObjectVars.TargetCompilePDB = targetCompilePdb.c_str(); + compileObjectVars.TargetPDB = targetPdb.c_str(); // Rule for compiling object file. std::string cudaCompileMode; diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 3f56113..2131f6d 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -189,6 +189,7 @@ protected: std::string const& objectDir, std::string const& objectFileName, std::string const& objectFileDir, std::string const& flags, std::string const& defines, std::string const& includes, + std::string const& targetCompilePdb, std::string const& targetPdb, std::string const& outputConfig); void AdditionalCleanFiles(const std::string& config); |