FindCUDA: Add relevant CMAKE_{C,CXX}_FLAGS for separable compilation
Previously only the CMAKE_{C,CXX}_FLAGS_<CONFIG> flags were inspected for relevant flags when compiling the intermediate link file. We need to also consider the configuration agnostic flags, CMAKE_{C,CXX}_FLAGS as well.
This commit is contained in:
parent
73144c098d
commit
b4e54f9b8c
|
@ -1423,7 +1423,8 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
|
||||||
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
|
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
|
||||||
list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
|
list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
|
||||||
endif()
|
endif()
|
||||||
# Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG}
|
|
||||||
|
# Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG} and CMAKE_${CUDA_C_OR_CXX}_FLAGS*
|
||||||
set(config_specific_flags)
|
set(config_specific_flags)
|
||||||
set(flags)
|
set(flags)
|
||||||
foreach(config ${CUDA_configuration_types})
|
foreach(config ${CUDA_configuration_types})
|
||||||
|
@ -1438,6 +1439,13 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
|
||||||
list(APPEND flags $<$<CONFIG:${config}>:-Xcompiler> $<$<CONFIG:${config}>:${f}>)
|
list(APPEND flags $<$<CONFIG:${config}>:-Xcompiler> $<$<CONFIG:${config}>:${f}>)
|
||||||
endforeach()
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
# Add CMAKE_${CUDA_C_OR_CXX}_FLAGS
|
||||||
|
set(important_host_flags)
|
||||||
|
_cuda_get_important_host_flags(important_host_flags ${CMAKE_${CUDA_C_OR_CXX}_FLAGS})
|
||||||
|
foreach(f ${important_host_flags})
|
||||||
|
list(APPEND flags -Xcompiler ${f})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
# Add our general CUDA_NVCC_FLAGS with the configuration specifig flags
|
# Add our general CUDA_NVCC_FLAGS with the configuration specifig flags
|
||||||
set(nvcc_flags ${CUDA_NVCC_FLAGS} ${config_specific_flags} ${nvcc_flags})
|
set(nvcc_flags ${CUDA_NVCC_FLAGS} ${config_specific_flags} ${nvcc_flags})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue