summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-07-13 15:40:08 (GMT)
committerBrad King <brad.king@kitware.com>2017-07-13 15:40:08 (GMT)
commit9d9085ab3614fa36d8b3e7e337468b53ae646b82 (patch)
tree070a437de17bad68d3a1762e20f48bb56a9b2f85 /Source
parentd11c48e0e344e6758a5575330b3f0e267d820e02 (diff)
parent712af07e4792beea6f3b62bddace9077d7fec525 (diff)
downloadCMake-9d9085ab3614fa36d8b3e7e337468b53ae646b82.zip
CMake-9d9085ab3614fa36d8b3e7e337468b53ae646b82.tar.gz
CMake-9d9085ab3614fa36d8b3e7e337468b53ae646b82.tar.bz2
Merge branch 'ninja_cuda_export_compile_commands_support' into release-3.9
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx27
1 files changed, 21 insertions, 6 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 2f4cccb..d38dbcb 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1064,13 +1064,28 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
compileObjectVars.Includes = includes.c_str();
// Rule for compiling object file.
- std::string compileCmdVar = "CMAKE_";
- compileCmdVar += language;
- compileCmdVar += "_COMPILE_OBJECT";
- std::string compileCmd =
- this->GetMakefile()->GetRequiredDefinition(compileCmdVar);
std::vector<std::string> compileCmds;
- cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ if (language == "CUDA") {
+ std::string cmdVar;
+ if (this->GeneratorTarget->GetPropertyAsBool(
+ "CUDA_SEPARABLE_COMPILATION")) {
+ cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION");
+ } else if (this->GeneratorTarget->GetPropertyAsBool(
+ "CUDA_PTX_COMPILATION")) {
+ cmdVar = std::string("CMAKE_CUDA_COMPILE_PTX_COMPILATION");
+ } else {
+ cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION");
+ }
+ std::string compileCmd =
+ this->GetMakefile()->GetRequiredDefinition(cmdVar);
+ cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ } else {
+ const std::string cmdVar =
+ std::string("CMAKE_") + language + "_COMPILE_OBJECT";
+ std::string compileCmd =
+ this->GetMakefile()->GetRequiredDefinition(cmdVar);
+ cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ }
CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->GetLocalGenerator()->CreateRulePlaceholderExpander());