[llvm] [Offload] Add `OFFLOAD_INCLUDE_TESTS` (PR #143388)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 08:03:54 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Ross Brunton (RossBrunton)
<details>
<summary>Changes</summary>
This is a cmake variable which, if set to `OFF` will disable building of
tests. It defaults to the value of `LLVM_INCLUDE_TESTS`.
---
Full diff: https://github.com/llvm/llvm-project/pull/143388.diff
1 Files Affected:
- (modified) offload/CMakeLists.txt (+14-10)
``````````diff
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()
``````````
</details>
https://github.com/llvm/llvm-project/pull/143388
More information about the llvm-commits
mailing list