[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=flang-rt (PR #110217)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Nov 12 02:53:40 PST 2024
================
@@ -0,0 +1,101 @@
+#===-- unittests/CMakeLists.txt --------------------------------------------===#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===------------------------------------------------------------------------===#
+
+# Add GTest if not already present.
+# Using a function so LLVM_SUBPROJECT_TITLE does not propagate.
+function (build_gtest)
+ set(LLVM_SUBPROJECT_TITLE "Third-Party/Google Test")
+ add_subdirectory("${LLVM_THIRD_PARTY_DIR}/unittest" "${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest")
+endfunction ()
+if (NOT TARGET llvm_gtest)
+ build_gtest()
+endif ()
+
+# LLVM's modified GTest depends on LLVM, but not all runtime projects using
+# GTest also add the include search path.
+target_include_directories(llvm_gtest PUBLIC "${LLVM_INCLUDE_DIR}" "${LLVM_MAIN_INCLUDE_DIR}")
----------------
jeanPerier wrote:
I am getting a cmake error here:
```
unittests/CMakeLists.txt:21 (target_include_directories):
target_include_directories may only set INTERFACE properties on IMPORTED
target
````
When building out of tree with test enabled (I previously built flang, clang, and llvm with `-DLLVM_INSTALL_GTEST=ON`).
https://github.com/llvm/llvm-project/pull/110217
More information about the llvm-branch-commits
mailing list