[flang-commits] [flang] 02a2e18 - [flang] Harmonize standalone gtest support with other projects
Michał Górny via flang-commits
flang-commits at lists.llvm.org
Wed Nov 23 18:29:26 PST 2022
Author: Michał Górny
Date: 2022-11-24T03:29:15+01:00
New Revision: 02a2e18e60b94b05fe8918aa01f0104ef519bf0f
URL: https://github.com/llvm/llvm-project/commit/02a2e18e60b94b05fe8918aa01f0104ef519bf0f
DIFF: https://github.com/llvm/llvm-project/commit/02a2e18e60b94b05fe8918aa01f0104ef519bf0f.diff
LOG: [flang] Harmonize standalone gtest support with other projects
Use the CMake rules of unittest libraries via `add_subdirectory()`
when using standalone builds, similarly to how e.g. Clang does that.
Besides making things more consistent, I hope this also unblocks D137035
and effectively we'll be able to simplify things further and have LLVM
semi-automatically include gtest support for us in the future.
Differential Revision: https://reviews.llvm.org/D138573
Added:
Modified:
flang/CMakeLists.txt
Removed:
################################################################################
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index ef514bebf186f..2115ae9f3d596 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -153,23 +153,7 @@ if (FLANG_STANDALONE_BUILD)
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
if (NOT TARGET llvm_gtest)
- add_library(llvm_gtest
- ${UNITTEST_DIR}/googletest/src/gtest-all.cc
- ${UNITTEST_DIR}/googlemock/src/gmock-all.cc
- )
- target_include_directories(llvm_gtest
- PUBLIC
- "${UNITTEST_DIR}/googletest/include"
- "${UNITTEST_DIR}/googlemock/include"
-
- PRIVATE
- "${UNITTEST_DIR}/googletest"
- "${UNITTEST_DIR}/googlemock"
- )
- find_package(Threads)
- target_link_libraries(llvm_gtest PUBLIC Threads::Threads)
- add_library(llvm_gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp)
- target_link_libraries(llvm_gtest_main PUBLIC llvm_gtest)
+ add_subdirectory(${UNITTEST_DIR} third-party/unittest)
endif()
set(FLANG_GTEST_AVAIL 1)
else()
More information about the flang-commits
mailing list