diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-08-05 10:15:41 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-08-09 12:53:31 +0200 |
commit | c8b629a3a5854506dd25e84f9b4174b53f8f667b (patch) | |
tree | dae3e80ba56c2cdf53337de1d21f3d67e9576624 /polly/CMakeLists.txt | |
parent | 04a23f1fe08a6ad0baf1305d7308231d2cb4843b (diff) | |
download | llvm-c8b629a3a5854506dd25e84f9b4174b53f8f667b.zip llvm-c8b629a3a5854506dd25e84f9b4174b53f8f667b.tar.gz llvm-c8b629a3a5854506dd25e84f9b4174b53f8f667b.tar.bz2 |
[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
Diffstat (limited to 'polly/CMakeLists.txt')
-rw-r--r-- | polly/CMakeLists.txt | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt index 2e94512..8b771f1 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 |