瀏覽代碼

[spirv] Silence GoogleTest std::tr1 deprecation warnings (#894)

Lei Zhang 7 年之前
父節點
當前提交
ea1bf8d24c
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 3 0
      external/GTestConfig.cmake
  2. 5 0
      tools/clang/unittests/SPIRV/CMakeLists.txt

+ 3 - 0
external/GTestConfig.cmake

@@ -21,6 +21,9 @@ include_directories(
 
 
 if(WIN32)
 if(WIN32)
   add_definitions(-DGTEST_OS_WINDOWS=1)
   add_definitions(-DGTEST_OS_WINDOWS=1)
+  # GoogleTest uses std::tr1, which is deprecated in VS2017.
+  # The following is an escape-hatch macro to silence the deprecation warnings.
+  add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
 endif()
 endif()
 
 
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
 if(SUPPORTS_VARIADIC_MACROS_FLAG)

+ 5 - 0
tools/clang/unittests/SPIRV/CMakeLists.txt

@@ -21,6 +21,11 @@ add_clang_unittest(clang-spirv-tests
   WholeFileTestFixture.cpp
   WholeFileTestFixture.cpp
   )
   )
 
 
+target_compile_definitions(clang-spirv-tests PRIVATE
+  # GoogleTest uses std::tr1, which is deprecated in VS2017.
+  # The following is an escape-hatch macro to silence the deprecation warnings.
+  -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
+
 target_link_libraries(clang-spirv-tests
 target_link_libraries(clang-spirv-tests
   clangCodeGen
   clangCodeGen
   clangFrontend
   clangFrontend