[Openmp-commits] [openmp] [OpenMP] Add `OPENMP_INCLUDE_TESTS` (PR #143390)
Ross Brunton via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jun 9 08:12:22 PDT 2025
https://github.com/RossBrunton created https://github.com/llvm/llvm-project/pull/143390
This is a cmake variable which, if set to `OFF`, will disable building of
tests. It defaults to the value of `LLVM_INCLUDE_TESTS`.
>From 935736cb6ddfc458fece21ee01799a5c44fda71b Mon Sep 17 00:00:00 2001
From: Ross Brunton <ross at codeplay.com>
Date: Mon, 9 Jun 2025 16:09:56 +0100
Subject: [PATCH] [OpenMP] Add `OPENMP_INCLUDE_TESTS`
This is a cmake variable which, if set to `OFF`, will disable building of
tests. It defaults to the value of `LLVM_INCLUDE_TESTS`.
---
openmp/CMakeLists.txt | 10 ++++++++--
openmp/libompd/CMakeLists.txt | 8 ++++----
openmp/runtime/CMakeLists.txt | 4 +++-
openmp/tools/archer/CMakeLists.txt | 4 +++-
openmp/tools/multiplex/CMakeLists.txt | 4 +++-
5 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index c206386fa6b61..e2ce9e93f3f4e 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -17,6 +17,8 @@ else()
set(OPENMP_STANDALONE_BUILD FALSE)
endif()
+option(OPENMP_INCLUDE_TESTS "Generate and build openmp tests." ${LLVM_INCLUDE_TESTS})
+
# Must go below project(..)
include(GNUInstallDirs)
@@ -93,7 +95,9 @@ include(config-ix)
include(HandleOpenMPOptions)
# Set up testing infrastructure.
-include(OpenMPTesting)
+if(OPENMP_INCLUDE_TESTS)
+ include(OpenMPTesting)
+endif()
set(OPENMP_TEST_FLAGS "" CACHE STRING
"Extra compiler flags to send to the test compiler.")
@@ -153,4 +157,6 @@ add_subdirectory(libompd)
add_subdirectory(docs)
# Now that we have seen all testsuites, create the check-openmp target.
-construct_check_openmp_target()
+if(OPENMP_INCLUDE_TESTS)
+ construct_check_openmp_target()
+endif()
diff --git a/openmp/libompd/CMakeLists.txt b/openmp/libompd/CMakeLists.txt
index e5373318784ce..59b200ec294b5 100644
--- a/openmp/libompd/CMakeLists.txt
+++ b/openmp/libompd/CMakeLists.txt
@@ -18,9 +18,9 @@ if(LIBOMP_OMPD_SUPPORT)
add_subdirectory(src)
if(LIBOMP_OMPD_GDB_SUPPORT)
add_subdirectory(gdb-plugin)
- # GDB is required to run the tests
- if (GDB_FOUND)
- add_subdirectory(test)
- endif()
+ # GDB is required to run the tests
+ if (GDB_FOUND AND OPENMP_INCLUDE_TESTS)
+ add_subdirectory(test)
+ endif()
endif()
endif()
diff --git a/openmp/runtime/CMakeLists.txt b/openmp/runtime/CMakeLists.txt
index b6c4759ec03f7..d017fec5b5d2f 100644
--- a/openmp/runtime/CMakeLists.txt
+++ b/openmp/runtime/CMakeLists.txt
@@ -468,7 +468,9 @@ if(${OPENMP_STANDALONE_BUILD})
endif()
add_subdirectory(src)
-add_subdirectory(test)
+if(OPENMP_INCLUDE_TESTS)
+ add_subdirectory(test)
+endif()
# make these variables available for tools:
set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE)
diff --git a/openmp/tools/archer/CMakeLists.txt b/openmp/tools/archer/CMakeLists.txt
index 980eb2b0b675f..ad3795bb96450 100644
--- a/openmp/tools/archer/CMakeLists.txt
+++ b/openmp/tools/archer/CMakeLists.txt
@@ -19,5 +19,7 @@ if(LIBOMP_OMPT_SUPPORT AND LIBOMP_ARCHER_SUPPORT)
LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR})
- add_subdirectory(tests)
+ if(OPENMP_INCLUDE_TESTS)
+ add_subdirectory(tests)
+ endif()
endif()
diff --git a/openmp/tools/multiplex/CMakeLists.txt b/openmp/tools/multiplex/CMakeLists.txt
index afc7fc5aa44ad..f44aa04f4354c 100644
--- a/openmp/tools/multiplex/CMakeLists.txt
+++ b/openmp/tools/multiplex/CMakeLists.txt
@@ -6,5 +6,7 @@ if(LIBOMP_OMPT_SUPPORT)
install(FILES ompt-multiplex.h DESTINATION "${LIBOMP_HEADERS_INSTALL_PATH}")
- add_subdirectory(tests)
+ if(OPENMP_INCLUDE_TESTS)
+ add_subdirectory(tests)
+ endif()
endif()
More information about the Openmp-commits
mailing list