summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-07-14 12:23:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-07-14 12:23:58 (GMT)
commit688b1c11ec6a9eb071594c77a4c92023660be20e (patch)
treee92474ac09b01afeb7c5917d22cf1eadfe27ebe2 /Source/cmNinjaTargetGenerator.cxx
parent38f81fab720ccf5eef6c94ffa2c84f7bb6c005d9 (diff)
parent712af07e4792beea6f3b62bddace9077d7fec525 (diff)
downloadCMake-688b1c11ec6a9eb071594c77a4c92023660be20e.zip
CMake-688b1c11ec6a9eb071594c77a4c92023660be20e.tar.gz
CMake-688b1c11ec6a9eb071594c77a4c92023660be20e.tar.bz2
Merge topic 'ninja_cuda_export_compile_commands_support'
712af07e CUDA: CMAKE_EXPORT_COMPILE_COMMANDS now works with CUDA and Ninja Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1055
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx27
1 files changed, 21 insertions, 6 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 79191ec..7cc6ede 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1059,13 +1059,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());