summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-05 14:16:34 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-04-05 14:16:38 (GMT)
commit8e6014f51d7c65d09b1f3ed640dff59e730cb22a (patch)
tree888b1a37193a77eb3414a56987f10c981316ee4b /Modules
parent6e9dc960c56b0baaf7599d21bb09d1a7e653d4f7 (diff)
parent9f41bfd7b9e6e8a7545f741f872949d2ae801978 (diff)
downloadCMake-8e6014f51d7c65d09b1f3ed640dff59e730cb22a.zip
CMake-8e6014f51d7c65d09b1f3ed640dff59e730cb22a.tar.gz
CMake-8e6014f51d7c65d09b1f3ed640dff59e730cb22a.tar.bz2
Merge topic 'FindCUDA-tll-keywords'
9f41bfd7 FindCUDA: Add option to use modern form of target_link_libraries Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Robert Maynard <robert.maynard@kitware.com> Merge-request: !663
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindCUDA.cmake21
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()