mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 22:58:37 -05:00
4fe9f534f5
Architecture 30 was removed with CUDA 11, so most of the CUDA tests fail with it. Remove setting the architecture and bump the minimum version to 3.18, so CMP0104 takes effect and we can rely on the default architecture, which is guaranteed to be compilable. Use of __ldg() in ProperLinkFlags was removed as it only affects performance and is available only on sm_35 and above. Testing the functionality of CUDA_ARCHITECTURES is already covered by CudaOnly.Architecture and CudaOnly.CompileFlags.
25 lines
846 B
CMake
25 lines
846 B
CMake
cmake_minimum_required(VERSION 3.18)
|
|
project(ProperLinkFlags CUDA CXX)
|
|
|
|
#Goal for this example:
|
|
#Verify that when we have CXX and CUDA enabled and we link an executable that
|
|
#has CUDA and CXX we use the CUDA link flags when doing the device link
|
|
#step
|
|
|
|
#Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA )
|
|
#to make sure we don't use the CXX flags when linking CUDA executables
|
|
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
|
string(APPEND CMAKE_CUDA_FLAGS "--use_fast_math")
|
|
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
|
string(APPEND CMAKE_CUDA_FLAGS "-ffast-math")
|
|
endif()
|
|
|
|
set(CMAKE_CXX_FLAGS "-Wall")
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
set(CMAKE_CUDA_STANDARD 11)
|
|
add_executable(ProperLinkFlags file1.cu main.cxx)
|
|
|
|
set_target_properties( ProperLinkFlags
|
|
PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|