[Lldb-commits] [PATCH] D65939: [lldb][CMake] Add LLDB_ENABLE_WERROR option

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 8 04:18:02 PDT 2019


sgraenitz created this revision.
sgraenitz added reviewers: teemperor, JDevlieghere, davide, labath, stella.stamenova.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

Treat warnings as errors all over LLDB when enabled. Defaults to `OFF`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65939

Files:
  lldb/cmake/caches/Apple-lldb-macOS.cmake
  lldb/cmake/modules/LLDBConfig.cmake


Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -51,6 +51,7 @@
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
 option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF)
 option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF)
+option(LLDB_ENABLE_WERROR "Fail and stop if a warning is triggered." ${LLVM_ENABLE_WERROR})
 
 if(LLDB_BUILD_FRAMEWORK)
   if(NOT APPLE)
@@ -311,6 +312,16 @@
   )
 endif()
 
+if(LLDB_ENABLE_WERROR)
+  set(flag_werror "-Werror")
+  if(MSVC)
+    set(flag_werror "/WX")
+  endif()
+
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag_werror}")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag_werror}")
+endif()
+
 # Use the Unicode (UTF-16) APIs by default on Win32
 if (CMAKE_SYSTEM_NAME MATCHES "Windows")
     add_definitions( -D_UNICODE -DUNICODE )
Index: lldb/cmake/caches/Apple-lldb-macOS.cmake
===================================================================
--- lldb/cmake/caches/Apple-lldb-macOS.cmake
+++ lldb/cmake/caches/Apple-lldb-macOS.cmake
@@ -2,6 +2,7 @@
 
 set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
 set(LLDB_NO_INSTALL_DEFAULT_RPATH ON CACHE BOOL "")
+set(LLDB_ENABLE_WERROR ON CACHE BOOL "")
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 
 # Default install location on the enduser machine. On the build machine, use the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65939.214111.patch
Type: text/x-patch
Size: 1519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190808/af99b6e1/attachment-0001.bin>


More information about the lldb-commits mailing list