From 119473eab355e5d029e7ad7830373ac69b507adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Thu, 30 Dec 2021 01:05:57 +0000 Subject: [PATCH] CMake: Use more consistent naming for options Having some options use DISABLE_ and others ENABLE_ is inconsistent and difficult to remember. Use ENABLE_ instead consistently. Frame-larger-than remains an exception. --- .gitlab-ci.yml | 2 +- CMakeLists.txt | 6 +++--- CMakeOptions.txt | 8 ++++---- README.msys2 | 2 +- docbook/release-notes.adoc | 5 ++++- packaging/rpm/wireshark.spec.in | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f251c87075..83b50559b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -697,7 +697,7 @@ Clang Static Analyzer: CC: "clang-${CLANG_VERSION}" CXX: "clang++-${CLANG_VERSION}" script: - - scan-build-${CLANG_VERSION} cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_WERROR=ON -G Ninja .. + - scan-build-${CLANG_VERSION} cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=OFF -G Ninja .. - scan-build-${CLANG_VERSION} -o ../sbout ninja - cd ../sbout - RAW_DIR=$( find ../sbout -type d -name "20??-??-??-*" -printf "%P\n" | head ) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3391da87d..3b33d7ae79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -464,8 +464,8 @@ set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS "G_DISABLE_DEPRECATED" "G_DISABLE_SINGLE_INCLUDES" - $<$,$>:WS_DISABLE_ASSERT> - $<$,$>:WS_DISABLE_DEBUG> + $<$>,$>:WS_DISABLE_ASSERT> + $<$>,$>:WS_DISABLE_DEBUG> ) if(WIN32) @@ -987,7 +987,7 @@ if(MSVC) endif() set(WERROR_COMMON_FLAGS "") -if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS) +if(ENABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS) if(CMAKE_C_COMPILER_ID MATCHES "MSVC") set(WERROR_COMMON_FLAGS "/WX") else() diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 98c48406af..0310cf9fd5 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -48,9 +48,10 @@ else() endif() option(BUILD_mmdbresolve "Build MaxMind DB resolver" ON) -option(DISABLE_WERROR "Do not treat warnings as errors" OFF) -option(DISABLE_DEBUG "Disable debug code" OFF) -option(DISABLE_ASSERT "Disable assertions" OFF) +option(ENABLE_WERROR "Treat warnings as errors" ON) +option(ENABLE_DEBUG "Enable debug code" ON) +option(ENABLE_ASSERT "Enable assertions" ON) +option(ENABLE_CCACHE "Speed up compiling and linking using ccache if possible" OFF) option(DISABLE_FRAME_LARGER_THAN_WARNING "Disable warning if the size of a function frame is large" OFF) option(EXTCAP_ANDROIDDUMP_LIBPCAP "Build androiddump using libpcap" OFF) option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (disables -Werror)" OFF) @@ -60,7 +61,6 @@ option(ENABLE_TSAN "Enable ThreadSanitizer (TSan) for debugging" OFF) option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF) option(ENABLE_FUZZER "Enable libFuzzer instrumentation for use with fuzzshark" OFF) option(ENABLE_CHECKHF_CONFLICT "Enable hf conflict check for debugging (start-up may be slower)" OFF) -option(ENABLE_CCACHE "Speed up compiling and linking using ccache if possible" OFF) if(CMAKE_GENERATOR STREQUAL "Ninja") option(ENABLE_COMPILER_COLOR_DIAGNOSTICS "Always enable the compiler's color diagnostic output" ON) diff --git a/README.msys2 b/README.msys2 index 52c6650d2f..23ba8b353f 100644 --- a/README.msys2 +++ b/README.msys2 @@ -37,7 +37,7 @@ From this point on it's a typical ninja build: 3. Run cmake: - $ cmake -DENABLE_CCACHE=Yes -DDISABLE_WERROR=Yes .. + $ cmake -DENABLE_CCACHE=Yes -DENABLE_WERROR=No .. 4. Build by running "ninja" in the build directory: diff --git a/docbook/release-notes.adoc b/docbook/release-notes.adoc index 59cbfd48b9..a55acfd021 100644 --- a/docbook/release-notes.adoc +++ b/docbook/release-notes.adoc @@ -74,7 +74,10 @@ They previously shipped with Npcap 1.55. * It is possible to set extcap passwords on cli for tshark and other cli tools. -// === Removed Features and Support + === Removed Features and Support + +* CMake: The options starting with DISABLE_something were renamed ENABLE_something for consistency. + For example DISABLE_WERROR=On became ENABLE_WERROR=Off. The defaults are unchanged. // === Removed Dissectors diff --git a/packaging/rpm/wireshark.spec.in b/packaging/rpm/wireshark.spec.in index 15a9da0f7a..85d7416c7b 100644 --- a/packaging/rpm/wireshark.spec.in +++ b/packaging/rpm/wireshark.spec.in @@ -364,7 +364,7 @@ cmake \ %else -DENABLE_BROTLI=OFF \ %endif - -DDISABLE_WERROR=ON \ + -DENABLE_WERROR=OFF \ %if %{with ninja} -G Ninja \ %endif