summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-12-13 13:01:49 -0500
committerBrad King <brad.king@kitware.com>2017-01-12 10:39:02 -0500
commitd470cb70077acf2216afe097b5abe379f1828239 (patch)
tree7facbd0f6efeb006ba29afd5990c71f855883297
parenta2e80cb0853b3b8306069b833ec8c2128a77b072 (diff)
downloadcmake-d470cb70077acf2216afe097b5abe379f1828239.tar.gz
CUDA: Use `.obj` object file extension on Windows
-rw-r--r--Modules/CMakeCUDAInformation.cmake6
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx6
4 files changed, 15 insertions, 5 deletions
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index cb0eef5471..abc4b66007 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -1,7 +1,11 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-set(CMAKE_CUDA_OUTPUT_EXTENSION .o)
+if(UNIX)
+ set(CMAKE_CUDA_OUTPUT_EXTENSION .o)
+else()
+ set(CMAKE_CUDA_OUTPUT_EXTENSION .obj)
+endif()
set(CMAKE_INCLUDE_FLAG_CUDA "-I")
# Load compiler-specific information.
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 069011dc10..480bb34535 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -104,10 +104,12 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
// Get the language to use for linking this library.
std::string linkLanguage = "CUDA";
+ std::string const objExt =
+ this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
// Get the name of the device object to generate.
std::string const targetOutputReal =
- this->GeneratorTarget->ObjectDirectory + "cmake_device_link.o";
+ this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt;
this->DeviceLinkObject = targetOutputReal;
this->NumberOfProgressActions++;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2b0e1b1b9d..d4ad16d7e1 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -281,6 +281,8 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
// Get the language to use for linking this library.
std::string linkLanguage = "CUDA";
+ std::string const objExt =
+ this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
// Create set of linking flags.
std::string linkFlags;
@@ -288,7 +290,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
// Get the name of the device object to generate.
std::string const targetOutputReal =
- this->GeneratorTarget->ObjectDirectory + "cmake_device_link.o";
+ this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt;
this->DeviceLinkObject = targetOutputReal;
this->NumberOfProgressActions++;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 0db5687aaa..10ee70d7d7 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -602,10 +602,12 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
// First and very important step is to make sure while inside this
// step our link language is set to CUDA
std::string cudaLinkLanguage = "CUDA";
+ std::string const objExt =
+ this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
std::string const cfgName = this->GetConfigName();
- std::string const targetOutputReal =
- ConvertToNinjaPath(genTarget.ObjectDirectory + "cmake_device_link.o");
+ std::string const targetOutputReal = ConvertToNinjaPath(
+ genTarget.ObjectDirectory + "cmake_device_link" + objExt);
std::string const targetOutputImplib =
ConvertToNinjaPath(genTarget.GetFullPath(cfgName,