diff options
author | Taylor Braun-Jones <taylor@braun-jones.org> | 2017-04-03 23:04:14 (GMT) |
---|---|---|
committer | Taylor Braun-Jones <taylor@braun-jones.org> | 2017-04-04 13:43:05 (GMT) |
commit | 9f41bfd7b9e6e8a7545f741f872949d2ae801978 (patch) | |
tree | 843ac44817f2a7912d20e277dc3a137727925a6b /Modules/FindCUDA.cmake | |
parent | 53e9c2d2a31f33f5d72c2df5558ffa7213a54a04 (diff) | |
download | CMake-9f41bfd7b9e6e8a7545f741f872949d2ae801978.zip CMake-9f41bfd7b9e6e8a7545f741f872949d2ae801978.tar.gz CMake-9f41bfd7b9e6e8a7545f741f872949d2ae801978.tar.bz2 |
FindCUDA: Add option to use modern form of target_link_libraries
This adds the option CUDA_LINK_LIBRARIES_KEYWORD which can be set to PRIVATE,
PUBLIC, or INTERFACE or left empty (the default) to use the old form of
target_link_libraries internally in FindCUDA macros.
Fixes: #16772
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r-- | Modules/FindCUDA.cmake | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 6b76c25..e323430 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -67,6 +67,13 @@ # -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files # when CUDA_BUILD_EMULATION is TRUE. # +# CUDA_LINK_LIBRARIES_KEYWORD (Default "") +# -- The <PRIVATE|PUBLIC|INTERFACE> keyword to use for internal +# target_link_libraries calls. The default is to use no keyword which +# uses the old "plain" form of target_link_libraries. Note that is matters +# because whatever is used inside the FindCUDA module must also be used +# outside - the two forms of target_link_libraries cannot be mixed. +# # CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR) # -- Set to the path you wish to have the generated files placed. If it is # blank output files will be placed in CMAKE_CURRENT_BINARY_DIR. @@ -1740,12 +1747,12 @@ macro(CUDA_ADD_LIBRARY cuda_target) # variable will have been defined. CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}") - target_link_libraries(${cuda_target} + target_link_libraries(${cuda_target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_LIBRARIES} ) if(CUDA_SEPARABLE_COMPILATION) - target_link_libraries(${cuda_target} + target_link_libraries(${cuda_target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cudadevrt_LIBRARY} ) endif() @@ -1790,7 +1797,7 @@ macro(CUDA_ADD_EXECUTABLE cuda_target) # variable will have been defined. CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}") - target_link_libraries(${cuda_target} + target_link_libraries(${cuda_target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_LIBRARIES} ) @@ -1876,9 +1883,9 @@ endmacro() ############################################################################### macro(CUDA_ADD_CUFFT_TO_TARGET target) if (CUDA_BUILD_EMULATION) - target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY}) + target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cufftemu_LIBRARY}) else() - target_link_libraries(${target} ${CUDA_cufft_LIBRARY}) + target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cufft_LIBRARY}) endif() endmacro() @@ -1889,9 +1896,9 @@ endmacro() ############################################################################### macro(CUDA_ADD_CUBLAS_TO_TARGET target) if (CUDA_BUILD_EMULATION) - target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY}) + target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cublasemu_LIBRARY}) else() - target_link_libraries(${target} ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY}) + target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY}) endif() endmacro() |