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
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
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits