diff options
author | Stella Laurenzo <stellaraccident@gmail.com> | 2022-03-02 10:17:05 -0800 |
---|---|---|
committer | Stella Laurenzo <laurenzo@google.com> | 2022-03-02 10:53:32 -0800 |
commit | 9f37775472b45986b0ecce5243bd6ce119e5bd69 (patch) | |
tree | 8defc4a07d4c4767aefd7d5aad066bc243c5f884 /flang/CMakeLists.txt | |
parent | 738042711bc08cde9135873200b1d088e6cf11c3 (diff) | |
download | llvm-9f37775472b45986b0ecce5243bd6ce119e5bd69.tar.gz |
[cmake] Prefix gtest and gtest_main with "llvm_".
The upstream project ships CMake rules for building vanilla gtest/gmock which conflict with the names chosen by LLVM. Since LLVM's build rules here are quite specific to LLVM, prefixing them to avoid collision is the right thing (i.e. there does not appear to be a path to letting someone *replace* LLVM's googletest with one they bring, so co-existence should be the goal).
This allows LLVM to be included with testing enabled within projects that themselves have a dependency on an official gtest release.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D120789
Diffstat (limited to 'flang/CMakeLists.txt')
-rw-r--r-- | flang/CMakeLists.txt | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 5caa79e8da47..e6ebd26203a1 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -148,12 +148,12 @@ if (FLANG_STANDALONE_BUILD) if (FLANG_INCLUDE_TESTS) set(UNITTEST_DIR ${LLVM_BUILD_MAIN_SRC_DIR}/utils/unittest) if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h) - if (NOT TARGET gtest) - add_library(gtest + 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(gtest + target_include_directories(llvm_gtest PUBLIC "${UNITTEST_DIR}/googletest/include" "${UNITTEST_DIR}/googlemock/include" @@ -163,9 +163,9 @@ if (FLANG_STANDALONE_BUILD) "${UNITTEST_DIR}/googlemock" ) find_package(Threads) - target_link_libraries(gtest PUBLIC Threads::Threads) - add_library(gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp) - target_link_libraries(gtest_main PUBLIC gtest) + target_link_libraries(llvm_gtest PUBLIC Threads::Threads) + add_library(llvm_gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp) + target_link_libraries(gtest_main PUBLIC llvm_gtest) endif() set(FLANG_GTEST_AVAIL 1) else() @@ -467,7 +467,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) PATTERN "config.h" EXCLUDE PATTERN ".git" EXCLUDE PATTERN "CMakeFiles" EXCLUDE) - + install(DIRECTORY ${FLANG_INCLUDE_DIR}/flang DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT flang-headers |