[Openmp-commits] [openmp] [OpenMP][omptest] Improve CMake and address review comments (PR #159416)
Michael Kruse via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jan 8 13:55:39 PST 2026
================
@@ -65,26 +65,44 @@ if ((NOT LIBOMPTEST_BUILD_STANDALONE) OR LIBOMPTEST_BUILD_UNITTESTS)
set(LIBOMPTEST_BUILD_STANDALONE OFF)
endif()
- # Add dependency llvm_gtest; emits error if unavailable.
- add_dependencies(omptest llvm_gtest)
-
- # Link llvm_gtest as whole-archive to expose required symbols
- set(GTEST_LINK_CMD "-Wl,--whole-archive" llvm_gtest
- "-Wl,--no-whole-archive" LLVMSupport)
-
- # Add GoogleTest-based header
- target_sources(omptest PRIVATE ./include/OmptTesterGoogleTest.h)
+ # Set and check GTest's source directory.
+ set(OMPTEST_GTEST_PATH ${LLVM_THIRD_PARTY_DIR}/unittest/googletest)
+ if(NOT EXISTS "${OMPTEST_GTEST_PATH}/src/gtest-all.cc")
+ message(FATAL_ERROR "Missing gtest-all.cc under ${OMPTEST_GTEST_PATH}. "
+ "Make sure LLVM_THIRD_PARTY_DIR is set properly.")
+ endif()
- # Add LLVM-provided GoogleTest include directories.
- target_include_directories(omptest PRIVATE
- ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include)
+ # Set GTest include directories for omptest
+ target_include_directories(omptest PUBLIC
+ $<BUILD_INTERFACE:${OMPTEST_GTEST_PATH}>
+ $<BUILD_INTERFACE:${OMPTEST_GTEST_PATH}/include>
+ )
- # TODO: Re-visit ABI breaking checks, disable for now.
- target_compile_definitions(omptest PUBLIC
- -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING)
+ # Make the targets default_gtest and default_gtest_main available.
+ build_gtest()
----------------
Meinersbur wrote:
LLVM_ENABLE_PROJECTS=openmp is going to be removed in #174963. Which is waiting for https://github.com/llvm/llvm-zorg/pull/699. Which would need this PR in order for publish-sphinx-docs to not break.
https://github.com/llvm/llvm-project/pull/159416
More information about the Openmp-commits
mailing list