[polly] c8b629a - [Polly] Reuse LLVM's build rules for gtest/gmock
Michał Górny via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 9 03:53:50 PDT 2020
Author: Michał Górny
Date: 2020-08-09T12:53:31+02:00
New Revision: c8b629a3a5854506dd25e84f9b4174b53f8f667b
URL: https://github.com/llvm/llvm-project/commit/c8b629a3a5854506dd25e84f9b4174b53f8f667b
DIFF: https://github.com/llvm/llvm-project/commit/c8b629a3a5854506dd25e84f9b4174b53f8f667b.diff
LOG: [Polly] Reuse LLVM's build rules for gtest/gmock
Reuse LLVM's CMakeLists.txt for gtest/gmock instead of reinventing
them in Polly. This fixes a lot of linking errors due to not linking
LLVMSupport in for me.
Differential Revision: https://reviews.llvm.org/D85280
Added:
Modified:
polly/CMakeLists.txt
Removed:
################################################################################
diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt
index 2e94512b2cff..8b771f163f12 100644
--- a/polly/CMakeLists.txt
+++ b/polly/CMakeLists.txt
@@ -27,35 +27,16 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
set(POLLY_GTEST_AVAIL 0)
set(UNITTEST_DIR ${LLVM_SOURCE_ROOT}/utils/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
- # The build tree already exports the gtest target, which we can reuse
- if (TARGET gtest)
- # LLVM Doesn't export gtest's include directorys, so do that here
- set_target_properties(gtest
- PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
- "${UNITTEST_DIR}/googletest/include;${UNITTEST_DIR}/googlemock/include"
- )
- set(POLLY_GTEST_AVAIL 1)
- else()
- add_library(gtest
- ${UNITTEST_DIR}/googletest/src/gtest-all.cc
- ${UNITTEST_DIR}/googlemock/src/gmock-all.cc
- )
- target_include_directories(gtest
- PUBLIC
- "${UNITTEST_DIR}/googletest/include"
- "${UNITTEST_DIR}/googlemock/include"
-
- PRIVATE
- "${UNITTEST_DIR}/googletest"
- "${UNITTEST_DIR}/googlemock"
- )
- target_link_libraries(gtest PUBLIC -lpthread)
-
- add_library(gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp)
- target_link_libraries(gtest_main PUBLIC gtest)
-
- set(POLLY_GTEST_AVAIL 1)
+ if (NOT TARGET gtest)
+ add_subdirectory(${UNITTEST_DIR} utils/unittest)
endif()
+
+ # LLVM Doesn't export gtest's include directorys, so do that here
+ set_target_properties(gtest
+ PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+ "${UNITTEST_DIR}/googletest/include;${UNITTEST_DIR}/googlemock/include"
+ )
+ set(POLLY_GTEST_AVAIL 1)
endif()
# Make sure the isl c files are built as fPIC
More information about the llvm-commits
mailing list