summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-10-08 12:48:54 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-10-08 12:49:03 (GMT)
commit51eb7130985aa3fb0fe55cd57502facca94758a2 (patch)
treec60193569ae9e85705ae20b41c2cec21291a3a06
parente7cacb057df5bb155ddb24cbca4b848061700891 (diff)
parenta4b60d948dabf91764deeab14b786858d978913d (diff)
downloadCMake-51eb7130985aa3fb0fe55cd57502facca94758a2.zip
CMake-51eb7130985aa3fb0fe55cd57502facca94758a2.tar.gz
CMake-51eb7130985aa3fb0fe55cd57502facca94758a2.tar.bz2
Merge topic 'FindOpenMP-CUDA-Clang'
a4b60d948d FindOpenMP: Add support for CUDA when compiling with Clang Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9886
-rw-r--r--.gitlab/ci/configure_cuda12.2_clang.cmake2
-rw-r--r--Help/release/dev/FindOpenMP-CUDA.rst3
-rw-r--r--Modules/FindOpenMP.cmake8
-rw-r--r--Tests/FindOpenMP/Test/main.c2
4 files changed, 7 insertions, 8 deletions
diff --git a/.gitlab/ci/configure_cuda12.2_clang.cmake b/.gitlab/ci/configure_cuda12.2_clang.cmake
index 8f10f86..ce4afaa 100644
--- a/.gitlab/ci/configure_cuda12.2_clang.cmake
+++ b/.gitlab/ci/configure_cuda12.2_clang.cmake
@@ -1,4 +1,6 @@
set(CMake_TEST_CUDA "Clang" CACHE STRING "")
set(CMake_TEST_CUDA_STANDARDS "03;11;14;17;20;23" CACHE STRING "")
+set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_CUDA "ON" CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/Help/release/dev/FindOpenMP-CUDA.rst b/Help/release/dev/FindOpenMP-CUDA.rst
index 3880855..9c21d53 100644
--- a/Help/release/dev/FindOpenMP-CUDA.rst
+++ b/Help/release/dev/FindOpenMP-CUDA.rst
@@ -1,5 +1,4 @@
FindOpenMP-CUDA
---------------
-* The :module:`FindOpenMP` module gained support for ``CUDA`` when using
- a CUDA compiler that supports OpenMP on the host.
+* The :module:`FindOpenMP` module gained support for the ``CUDA`` language.
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 32e4cf2..07eaf66 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -183,12 +183,10 @@ set(OpenMP_C_CXX_TEST_SOURCE
int main(void) {
#ifdef _OPENMP
omp_get_max_threads();
- return 0;
-#elif defined(__HIP_DEVICE_COMPILE__)
- return 0;
-#else
- breaks_on_purpose
+#elif !defined(__CUDA_ARCH__) && !defined(__HIP_DEVICE_COMPILE__)
+# error \"_OPENMP not defined!\"
#endif
+ return 0;
}
")
diff --git a/Tests/FindOpenMP/Test/main.c b/Tests/FindOpenMP/Test/main.c
index f7abef8..f60fce8 100644
--- a/Tests/FindOpenMP/Test/main.c
+++ b/Tests/FindOpenMP/Test/main.c
@@ -3,7 +3,7 @@ int main(void)
{
#ifdef _OPENMP
omp_get_num_threads();
-#else
+#elif !defined(__CUDA_ARCH__) && !defined(__HIP_DEVICE_COMPILE__)
# error "_OPENMP not defined!"
#endif
return 0;