summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/cmLocalGenerator.cxx13
-rw-r--r--Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake33
2 files changed, 31 insertions, 15 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f299202999..fba9cdb317 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1986,6 +1986,19 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
} else if (lang == "CUDA") {
target->AddCUDAArchitectureFlags(flags);
+
+ std::string const& compiler =
+ this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
+
+ if (compiler == "Clang") {
+ bool separable = target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION");
+
+ if (separable) {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "CUDA_SEPARABLE_COMPILATION isn't supported on Clang.");
+ }
+ }
}
// Add MSVC runtime library flags. This is activated by the presence
diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake
index 4d0c02f4f6..01260805ad 100644
--- a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake
+++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake
@@ -21,26 +21,29 @@ target_link_options (LinkOptions_private PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEV
if (CMake_TEST_CUDA)
enable_language(CUDA)
- add_executable(LinkOptions_CMP0105_UNSET LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_CMP0105_UNSET PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_CMP0105_UNSET PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
+ # Separable compilation is only supported on NVCC.
+ if(NOT CMake_TEST_CUDA STREQUAL "Clang")
+ add_executable(LinkOptions_CMP0105_UNSET LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_CMP0105_UNSET PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_CMP0105_UNSET PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
- cmake_policy(SET CMP0105 OLD)
+ cmake_policy(SET CMP0105 OLD)
- add_executable(LinkOptions_CMP0105_OLD LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_CMP0105_OLD PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_CMP0105_OLD PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
+ add_executable(LinkOptions_CMP0105_OLD LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_CMP0105_OLD PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_CMP0105_OLD PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
- cmake_policy(SET CMP0105 NEW)
+ cmake_policy(SET CMP0105 NEW)
- add_executable(LinkOptions_CMP0105_NEW LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_CMP0105_NEW PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_CMP0105_NEW PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
+ add_executable(LinkOptions_CMP0105_NEW LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_CMP0105_NEW PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_CMP0105_NEW PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>)
- add_executable(LinkOptions_device LinkOptionsDevice.cu)
- set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON)
- target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>
- $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>)
+ add_executable(LinkOptions_device LinkOptionsDevice.cu)
+ set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+ target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>
+ $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>)
+ endif()
add_executable(LinkOptions_no_device LinkOptionsDevice.cu)
target_link_options(LinkOptions_no_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}>