mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
c57541d874
With CUDAARCHS there's the possibility of tests being run with multiple architectures or having CMAKE_CUDA_ARCHITECTURES set with NVCC despite CMP0104 being OLD. Fix a few tests to work properly in such cases.
17 lines
546 B
CMake
17 lines
546 B
CMake
cmake_minimum_required(VERSION 3.17)
|
|
project(CompileFlags CUDA)
|
|
|
|
add_executable(CudaOnlyCompileFlags main.cu)
|
|
|
|
# Try passing CUDA architecture flags explicitly.
|
|
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
|
target_compile_options(CudaOnlyCompileFlags PRIVATE
|
|
-gencode arch=compute_50,code=compute_50
|
|
)
|
|
set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES)
|
|
else()
|
|
set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES 50-real)
|
|
endif()
|
|
|
|
target_compile_options(CudaOnlyCompileFlags PRIVATE -DALWAYS_DEFINE)
|