Skip to content

Commit 880552c

Browse files
committed
[OpenMP][omptest] Fix buildbot CMake issues
Adapted minimum CMake version Fixed llvm_gtest linking - Replaced archive path with target name - Fixed related warning and added checks for llvm_gtest
1 parent 91bc219 commit 880552c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

openmp/tools/omptest/CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
##===----------------------------------------------------------------------===##
66

7-
cmake_minimum_required(VERSION 3.22)
7+
cmake_minimum_required(VERSION 3.20)
88
project(omptest LANGUAGES CXX)
99

1010
option(LIBOMPTEST_BUILD_STANDALONE
@@ -52,7 +52,7 @@ if ((NOT LIBOMPTEST_BUILD_STANDALONE) OR LIBOMPTEST_BUILD_UNITTESTS)
5252
# Check if standalone build was requested together with unittests
5353
if (LIBOMPTEST_BUILD_STANDALONE)
5454
# Emit warning: this build actually depends on LLVM's GoogleTest
55-
message(Warning "LIBOMPTEST_BUILD_STANDALONE and LIBOMPTEST_BUILD_UNITTESTS"
55+
message(WARNING "LIBOMPTEST_BUILD_STANDALONE and LIBOMPTEST_BUILD_UNITTESTS"
5656
" requested simultaneously.\n"
5757
"Linking against LLVM's GoogleTest library archives.\n"
5858
"Disable LIBOMPTEST_BUILD_UNITTESTS to perform an actual"
@@ -61,11 +61,16 @@ if ((NOT LIBOMPTEST_BUILD_STANDALONE) OR LIBOMPTEST_BUILD_UNITTESTS)
6161
set(LIBOMPTEST_BUILD_STANDALONE OFF)
6262
endif()
6363

64-
# Use LLVM's gtest library archive
65-
set(GTEST_LIB "${LLVM_BINARY_DIR}/lib/libllvm_gtest.a")
64+
# Make sure target llvm_gtest is available
65+
if (NOT TARGET llvm_gtest)
66+
message(FATAL_ERROR "Required target not found: llvm_gtest")
67+
endif()
68+
69+
# Add llvm_gtest as dependency
70+
add_dependencies(omptest llvm_gtest)
6671

67-
# Link gtest as whole-archive to expose required symbols
68-
set(GTEST_LINK_CMD "-Wl,--whole-archive" ${GTEST_LIB}
72+
# Link llvm_gtest as whole-archive to expose required symbols
73+
set(GTEST_LINK_CMD "-Wl,--whole-archive" llvm_gtest
6974
"-Wl,--no-whole-archive" LLVMSupport)
7075

7176
# Add GoogleTest-based header

0 commit comments

Comments
 (0)