mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 06:47:08 -05:00
a4d502a5bf
Checks added in commit 81b4d10d8f (CUDA: More exhaustive checks to
determine when to do device linking, 2019-05-09, v3.15.0-rc1~82^2)
assumed that CUDA properties would be set only if CUDA is enabled.
We cannot do a device link step if we do not have the CUDA language
enabled. This was discovered as some projects unconditionally set CUDA
properties such as `CUDA_RESOLVE_DEVICE_SYMBOLS` even when the CUDA
language has not been enabled.
Fixes: #19432
15 lines
566 B
CMake
15 lines
566 B
CMake
cmake_minimum_required(VERSION 3.7)
|
|
project(CudaNotEnabled CXX)
|
|
|
|
add_library(HasCudaProps lib.cxx)
|
|
|
|
target_compile_features(HasCudaProps PUBLIC cxx_std_11)
|
|
#Verify that setting this variables in a project that doesn't have CUDA
|
|
#enabled allow for the project to configure and build correctly.
|
|
#Tests the fix for #19432
|
|
set_property(TARGET HasCudaProps PROPERTY CUDA_SEPARABLE_COMPILATION ON)
|
|
set_property(TARGET HasCudaProps PROPERTY CUDA_RESOLVE_DEVICE_SYMBOLS ON)
|
|
|
|
add_executable(CudaNotEnabled main.cxx)
|
|
target_link_libraries(CudaNotEnabled PRIVATE HasCudaProps)
|