[PATCH] D93794: Fixed a build error when using CMake 3.15.1 + NDK-R20

AnZhong Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 21:28:57 PST 2020


azhuang created this revision.
azhuang added a reviewer: tpr.
Herald added subscribers: lebedev.ri, mgorny.
Herald added a reviewer: lebedev.ri.
azhuang requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

std::decay_t used by llvm/utils/benchmark/include/benchmark/benchmark.h is a c++14 feature, but the CMakelist uses c++11, it's the root-cause of build error.

  There are two options to fix the error.
  1) change the CMakelist to support c++14, it's what the patch done.
  2) change std::decay_t to std::decay
  
  This bug can only be reproduced by CMake 3.15, we didn't observer the bug with CMake 3.16. But based on the code's logic, it's an obvious bug of LLVM.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93794

Files:
  llvm/utils/benchmark/CMakeLists.txt


Index: llvm/utils/benchmark/CMakeLists.txt
===================================================================
--- llvm/utils/benchmark/CMakeLists.txt
+++ llvm/utils/benchmark/CMakeLists.txt
@@ -131,12 +131,7 @@
     set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /LTCG")
   endif()
 else()
-  # Try and enable C++11. Don't use C++14 because it doesn't work in some
-  # configurations.
-  add_cxx_compiler_flag(-std=c++11)
-  if (NOT HAVE_CXX_FLAG_STD_CXX11)
-    add_cxx_compiler_flag(-std=c++0x)
-  endif()
+  add_cxx_compiler_flag(-std=c++14)
 
   # Turn compiler warnings up to 11
   add_cxx_compiler_flag(-Wall)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93794.313653.patch
Type: text/x-patch
Size: 647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201224/85c77791/attachment.bin>


More information about the llvm-commits mailing list