[llvm] [Offload] Add `OFFLOAD_INCLUDE_TESTS` (PR #143388)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 08:03:13 PDT 2025
https://github.com/RossBrunton created https://github.com/llvm/llvm-project/pull/143388
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 31c64795a608d78cefd91e52d887e840746edec8 Mon Sep 17 00:00:00 2001
From: Ross Brunton <ross at codeplay.com>
Date: Mon, 9 Jun 2025 16:01:16 +0100
Subject: [PATCH] [Offload] Add `OFFLOAD_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`.
---
offload/CMakeLists.txt | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index 09eae0f5d3aea..0a441c3bc5782 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -41,6 +41,8 @@ endif()
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+option(OFFLOAD_INCLUDE_TESTS "Generate and build offload tests." ${LLVM_INCLUDE_TESTS})
+
# Add path for custom modules
list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
@@ -376,15 +378,17 @@ add_subdirectory(libomptarget)
add_subdirectory(liboffload)
# Add tests.
-add_subdirectory(test)
+if(OFFLOAD_INCLUDE_TESTS)
+ add_subdirectory(test)
-# Add unit tests if GMock/GTest is present
-if(NOT LLVM_THIRD_PARTY_DIR)
- set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
-endif()
-if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest AND NOT TARGET llvm_gtest)
- add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
-endif()
-if(TARGET llvm_gtest)
- add_subdirectory(unittests)
+ # Add unit tests if GMock/GTest is present
+ if(NOT LLVM_THIRD_PARTY_DIR)
+ set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
+ endif()
+ if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest AND NOT TARGET llvm_gtest)
+ add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
+ endif()
+ if(TARGET llvm_gtest)
+ add_subdirectory(unittests)
+ endif()
endif()
More information about the llvm-commits
mailing list