summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/Architecture/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CudaOnly/Architecture/CMakeLists.txt')
-rw-r--r--Tests/CudaOnly/Architecture/CMakeLists.txt14
1 files changed, 12 insertions, 2 deletions
diff --git a/Tests/CudaOnly/Architecture/CMakeLists.txt b/Tests/CudaOnly/Architecture/CMakeLists.txt
index 7270b56..03e972f 100644
--- a/Tests/CudaOnly/Architecture/CMakeLists.txt
+++ b/Tests/CudaOnly/Architecture/CMakeLists.txt
@@ -1,5 +1,15 @@
-cmake_minimum_required(VERSION 3.17)
+cmake_minimum_required(VERSION 3.18)
project(Architecture CUDA)
-set(CMAKE_CUDA_ARCHITECTURES 52)
add_executable(Architecture main.cu)
+set_property(TARGET Architecture PROPERTY CUDA_ARCHITECTURES 52)
+
+# Make sure CMake doesn't pass architectures if CUDA_ARCHITECTURES is OFF.
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_52")
+elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --cuda-gpu-arch=sm_52")
+endif()
+
+add_executable(ArchitectureOff main.cu)
+set_property(TARGET ArchitectureOff PROPERTY CUDA_ARCHITECTURES OFF)