[Lldb-commits] [PATCH] D84748: [cmake] Make gtest macro definitions a part the library interface

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 11 06:23:00 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb91c9fe7b62: [cmake] Make gtest macro definitions a part the library interface (authored by labath).
Herald added a subscriber: JDevlieghere.

Changed prior to commit:
  https://reviews.llvm.org/D84748?vs=281214&id=284687#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84748/new/

https://reviews.llvm.org/D84748

Files:
  lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/lib/Testing/Support/CMakeLists.txt
  llvm/utils/unittest/CMakeLists.txt


Index: llvm/utils/unittest/CMakeLists.txt
===================================================================
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -19,9 +19,6 @@
   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 @@
 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 @@
   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
Index: llvm/lib/Testing/Support/CMakeLists.txt
===================================================================
--- llvm/lib/Testing/Support/CMakeLists.txt
+++ llvm/lib/Testing/Support/CMakeLists.txt
@@ -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
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1400,15 +1400,8 @@
     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")
Index: lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
===================================================================
--- lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
+++ lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
@@ -3,13 +3,6 @@
   YAMLModuleTester.cpp
   )
 
-# Our current version of gtest does not properly recognize C++11 support
-# with MSVC, so it falls back to tr1 / experimental classes.  Since LLVM
-# itself requires C++11, we can safely force it on unconditionally so that
-# we don't have to fight with the buggy gtest check.
-target_compile_definitions(lldbSymbolHelpers PUBLIC
-  -DGTEST_LANG_CXX11=1
-  -DGTEST_HAS_TR1_TUPLE=0)
 target_include_directories(lldbSymbolHelpers PUBLIC
   ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include
   ${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock/include)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84748.284687.patch
Type: text/x-patch
Size: 3194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200811/912776d2/attachment-0001.bin>


More information about the lldb-commits mailing list