summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/cuda-check-support.rst3
-rw-r--r--Modules/CheckLinkerFlag.cmake2
-rw-r--r--Tests/RunCMake/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake3
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake4
5 files changed, 15 insertions, 1 deletions
diff --git a/Help/release/dev/cuda-check-support.rst b/Help/release/dev/cuda-check-support.rst
index 50a42d6..d88ef94 100644
--- a/Help/release/dev/cuda-check-support.rst
+++ b/Help/release/dev/cuda-check-support.rst
@@ -9,3 +9,6 @@ cuda-check-support
* The :module:`CheckSourceRuns` module was extended to
support 'CUDA'.
+
+* The :module:`CheckLinkerFlag` module has been extended to
+ support the validity of CUDA link flags.
diff --git a/Modules/CheckLinkerFlag.cmake b/Modules/CheckLinkerFlag.cmake
index 051e0bc..f56d365 100644
--- a/Modules/CheckLinkerFlag.cmake
+++ b/Modules/CheckLinkerFlag.cmake
@@ -66,6 +66,8 @@ function(CHECK_LINKER_FLAG _lang _flag _var)
set (_source "int main() { return 0; }")
elseif (_lang STREQUAL "Fortran")
set (_source " program test\n stop\n end program")
+ elseif (_lang MATCHES "CUDA")
+ set (_source "__host__ int main() { return 0; }")
elseif (_lang MATCHES "^(OBJC|OBJCXX)$")
set (_source "#ifndef __OBJC__\n# error \"Not an Objective-C++ compiler\"\n#endif\nint main(void) { return 0; }")
else()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 68bd0d9..63738d7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -555,7 +555,9 @@ add_RunCMake_test(CheckIPOSupported)
if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)"
AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU"))
add_RunCMake_test(CheckLinkerFlag -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
- -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID})
+ -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}
+ -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
+ set_property(TEST RunCMake.CheckLinkerFlag APPEND PROPERTY LABELS "CUDA")
endif()
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake
new file mode 100644
index 0000000..84d6dd9
--- /dev/null
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake
@@ -0,0 +1,3 @@
+
+set (CHECK_LANGUAGE CUDA)
+include ("${CMAKE_CURRENT_SOURCE_DIR}/CheckLinkerFlag.cmake")
diff --git a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
index 224a2a3..6ec9148 100644
--- a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
@@ -12,3 +12,7 @@ endif()
if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
run_cmake(CheckFortranLinkerFlag)
endif()
+
+if (CMake_TEST_CUDA)
+ run_cmake(CheckCUDALinkerFlag)
+endif()