[llvm] 4f5ccc7 - Partially revert "[cmake] Make MSVC generate appropriate __cplusplus macro definition"

Tatyana Krasnukha via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 02:22:31 PDT 2020


Author: Tatyana Krasnukha
Date: 2020-08-04T12:22:11+03:00
New Revision: 4f5ccc72f6a6eba61117806f049ca869233a6864

URL: https://github.com/llvm/llvm-project/commit/4f5ccc72f6a6eba61117806f049ca869233a6864
DIFF: https://github.com/llvm/llvm-project/commit/4f5ccc72f6a6eba61117806f049ca869233a6864.diff

LOG: Partially revert "[cmake] Make MSVC generate appropriate __cplusplus macro definition"

The /Zc:__cplusplus option fixes GTEST_LANG_CXX11 value but not GTEST_HAS_TR1_TUPLE,
so we still need to force the latter off.

Still pass the option since it is required by https://reviews.llvm.org/D78186 too.

Differential Revision: https://reviews.llvm.org/D84023

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake
    llvm/utils/unittest/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 5b5be953767b..2ff5c29c6b1a 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1405,6 +1405,10 @@ 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)

diff  --git a/llvm/utils/unittest/CMakeLists.txt b/llvm/utils/unittest/CMakeLists.txt
index 9127ebce7b4c..e7caf37727fc 100644
--- a/llvm/utils/unittest/CMakeLists.txt
+++ b/llvm/utils/unittest/CMakeLists.txt
@@ -19,6 +19,9 @@ 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()


        


More information about the llvm-commits mailing list