[PATCH] D87243: [cmake] Centralize LLVM_ENABLE_WARNINGS option

Dave Lee via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 10:00:39 PDT 2020


kastiglione created this revision.
Herald added subscribers: llvm-commits, libcxx-commits, cfe-commits, mgorny.
Herald added a reviewer: DavidTruby.
Herald added projects: clang, libunwind, LLVM.
Herald added a reviewer: libunwind.
kastiglione requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87243

Files:
  clang/CMakeLists.txt
  flang/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -105,10 +105,6 @@
   # Avoid checking whether the compiler is working.
   set(LLVM_COMPILER_CHECKED ON)
 
-  # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions
-  # resulting in unjustified successes by check_cxx_compiler_flag.
-  set(LLVM_ENABLE_WARNINGS ON)
-
   # Handle common options used by all runtimes.
   include(AddLLVM)
   include(HandleLLVMOptions)
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -409,6 +409,8 @@
   endif()
 endif()
 
+option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
+
 if( MSVC )
   include(ChooseMSVCCRT)
 
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -399,7 +399,6 @@
 list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
 
 option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
-option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
 option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." ON)
Index: libunwind/CMakeLists.txt
===================================================================
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -73,8 +73,6 @@
   endif()
 
   if (EXISTS ${LLVM_CMAKE_PATH})
-    # Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions.
-    set(LLVM_ENABLE_WARNINGS ON)
     list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
     include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
     include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
Index: flang/CMakeLists.txt
===================================================================
--- flang/CMakeLists.txt
+++ flang/CMakeLists.txt
@@ -62,7 +62,6 @@
   if(LLVM_ENABLE_ZLIB)
     find_package(ZLIB REQUIRED)
   endif()
-  option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
   option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
   if(CMAKE_COMPILER_IS_GNUCXX)
     set(USE_NO_MAYBE_UNINITIALIZED 1)
Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -105,7 +105,6 @@
     set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
   endif()
 
-  option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
   option(LLVM_INSTALL_TOOLCHAIN_ONLY
     "Only include toolchain files in the 'install' target." OFF)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87243.290309.patch
Type: text/x-patch
Size: 2787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200907/b6e6f165/attachment.bin>


More information about the cfe-commits mailing list