Skip to content

Commit 154b376

Browse files
committed
Compatibility with LLVM_INSTALL_GTEST
1 parent c88295b commit 154b376

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

flang-rt/unittests/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
#
77
#===------------------------------------------------------------------------===#
88

9+
# LLVM uses a modified version of GTest that uses LLVMSupport for console
10+
# output. Therefore it also needs to include files from LLVM. Unfortunately,
11+
# LLVM/GTest doesn't add the include search path itself. Limiting the scope
12+
# using target_include_directories does not work because with
13+
# LLVM_INSTALL_GTEST=ON, llvm_gtest is an IMPORT library.
14+
include_directories("${LLVM_INCLUDE_DIR}" "${LLVM_MAIN_INCLUDE_DIR}")
15+
916
# Add GTest if not already present.
1017
# Using a function so LLVM_SUBPROJECT_TITLE does not propagate.
1118
function (build_gtest)
@@ -16,10 +23,6 @@ if (NOT TARGET llvm_gtest)
1623
build_gtest()
1724
endif ()
1825

19-
# LLVM's modified GTest depends on LLVM, but not all sibling runtime projects
20-
# creating a llvm_gtest target also use target_include_directories.
21-
target_include_directories(llvm_gtest PUBLIC "${LLVM_INCLUDE_DIR}" "${LLVM_MAIN_INCLUDE_DIR}")
22-
2326
# Required because LLVMSupport is compiled with this option (by default).
2427
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
2528

0 commit comments

Comments
 (0)