From 071c4f1a2a44de1e3e9d2c5ce22a661edf334f8b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 7 Jan 2020 11:49:09 -0500 Subject: CUDA: Do not device link if target has no CUDA usage When CUDA is enabled, and a pure non-CUDA target has CMAKE_CUDA_SEPARABLE_COMPILATION enabled, don't actually perform the device linking step, as it will fail. A target that has CMAKE_CUDA_SEPARABLE_COMPILATION enabled must also have CUDA usage (either itself, or something it links to). Fixes: #20182 --- Tests/Cuda/CMakeLists.txt | 1 + Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt | 3 +++ Tests/Cuda/SeparableCompCXXOnly/main.cpp | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt create mode 100644 Tests/Cuda/SeparableCompCXXOnly/main.cpp (limited to 'Tests/Cuda') diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt index a30071fd3a..44c60052fb 100644 --- a/Tests/Cuda/CMakeLists.txt +++ b/Tests/Cuda/CMakeLists.txt @@ -4,6 +4,7 @@ ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures) ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary) ADD_TEST_MACRO(Cuda.MixedStandardLevels MixedStandardLevels) ADD_TEST_MACRO(Cuda.NotEnabled CudaNotEnabled) +ADD_TEST_MACRO(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly) ADD_TEST_MACRO(Cuda.ToolkitInclude CudaToolkitInclude) ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries) ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags) diff --git a/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt new file mode 100644 index 0000000000..97670e392c --- /dev/null +++ b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt @@ -0,0 +1,3 @@ +project(SeparableCompCXXOnly LANGUAGES CXX CUDA) +set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) +add_executable(SeparableCompCXXOnly main.cpp) diff --git a/Tests/Cuda/SeparableCompCXXOnly/main.cpp b/Tests/Cuda/SeparableCompCXXOnly/main.cpp new file mode 100644 index 0000000000..8135246149 --- /dev/null +++ b/Tests/Cuda/SeparableCompCXXOnly/main.cpp @@ -0,0 +1,5 @@ + +int main(int, char const* []) +{ + return 0; +} -- cgit v1.2.1