mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[cmake] Make gtest macro definitions a part the library interface
These definitions are needed by any file which uses gtest. Previously we were adding them in the add_unittest function, but over time we've accumulated libraries (which don't go through add_unittest) building on gtest and this has resulted in proliferation of the definitions. Making this a part of the library interface enables them to be managed centrally. This follows a patch for -Wno-suggest-override (D84554) which took a similar approach. Differential Revision: https://reviews.llvm.org/D84748
This commit is contained in:
parent
ad368223b7
commit
336dae54b1
@ -1400,15 +1400,8 @@ function(add_unittest test_suite test_name)
|
||||
set(EXCLUDE_FROM_ALL ON)
|
||||
endif()
|
||||
|
||||
# Our current version of gtest uses tr1/tuple which is deprecated on MSVC.
|
||||
# Since LLVM itself requires C++14, we can safely force it off.
|
||||
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
|
||||
|
||||
include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
|
||||
include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock/include)
|
||||
if (NOT LLVM_ENABLE_THREADS)
|
||||
list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_PTHREAD=0)
|
||||
endif ()
|
||||
|
||||
if (SUPPORTS_VARIADIC_MACROS_FLAG)
|
||||
list(APPEND LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
|
||||
|
@ -1,6 +1,3 @@
|
||||
add_definitions(-DGTEST_LANG_CXX11=1)
|
||||
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
|
||||
|
||||
add_llvm_library(LLVMTestingSupport
|
||||
Annotations.cpp
|
||||
Error.cpp
|
||||
|
@ -19,9 +19,6 @@ include_directories(
|
||||
googlemock
|
||||
)
|
||||
|
||||
# Gtest 1.8.0 uses tr1/tuple which is deprecated on MSVC, so we force it off.
|
||||
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DGTEST_OS_WINDOWS=1)
|
||||
endif()
|
||||
@ -45,10 +42,6 @@ endif()
|
||||
set(LLVM_REQUIRES_RTTI 1)
|
||||
add_definitions( -DGTEST_HAS_RTTI=0 )
|
||||
|
||||
if (NOT LLVM_ENABLE_THREADS)
|
||||
add_definitions( -DGTEST_HAS_PTHREAD=0 )
|
||||
endif()
|
||||
|
||||
find_library(LLVM_PTHREAD_LIBRARY_PATH pthread)
|
||||
if (LLVM_PTHREAD_LIBRARY_PATH)
|
||||
list(APPEND LIBS pthread)
|
||||
@ -76,6 +69,13 @@ if(CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
|
||||
set_target_properties(gtest PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-suggest-override")
|
||||
endif()
|
||||
|
||||
# Gtest 1.8.0 uses tr1/tuple which is deprecated on MSVC, so we force it off.
|
||||
target_compile_definitions(gtest PUBLIC GTEST_HAS_TR1_TUPLE=0)
|
||||
|
||||
if (NOT LLVM_ENABLE_THREADS)
|
||||
target_compile_definitions(gtest PUBLIC GTEST_HAS_PTHREAD=0)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(UnitTestMain)
|
||||
|
||||
# When LLVM_LINK_LLVM_DYLIB is enabled, libLLVM.so is added to the interface
|
||||
|
Loading…
x
Reference in New Issue
Block a user