Add `ENABLE_WERROR` option for use on CI (#4381)

Defaults to `OFF`. Downstream packagers are advised against enabling it
as we can't guarantee it working on every possible configuration.

Added the actual compile flag in the GTK client subdirectory and not
the top-level CMakeLists.txt file due to other subprojects not being
ready.

Fixed the only GTK client warning reported by Clang on Mac.
This commit is contained in:
Mike Gelfand 2022-12-16 14:38:30 -08:00 committed by GitHub
parent 0cb1ea8ed8
commit 67c4e4081c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 3 deletions

View File

@ -210,6 +210,7 @@ jobs:
-DENABLE_TESTS=OFF \
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
-DENABLE_WEB=OFF \
-DENABLE_WERROR=ON \
-DRUN_CLANG_TIDY=OFF
- name: Make
run: cmake --build obj --config RelWithDebInfo
@ -284,6 +285,7 @@ jobs:
-DENABLE_TESTS=OFF \
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
-DENABLE_WEB=OFF \
-DENABLE_WERROR=ON \
-DRUN_CLANG_TIDY=OFF
- name: Make
run: cmake --build obj --config RelWithDebInfo
@ -375,6 +377,7 @@ jobs:
-DENABLE_TESTS=ON `
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-dist == 'true' || needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} `
-DENABLE_WEB=OFF `
-DENABLE_WERROR=ON `
-DRUN_CLANG_TIDY=OFF
- name: Make
run: |
@ -478,6 +481,7 @@ jobs:
-DENABLE_TESTS=${{ (needs.what-to-make.outputs.make-tests == 'true') && 'ON' || 'OFF' }} \
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
-DENABLE_WEB=OFF \
-DENABLE_WERROR=ON \
-DRUN_CLANG_TIDY=OFF
- name: Make
run: cmake --build obj --config RelWithDebInfo
@ -553,6 +557,7 @@ jobs:
-DENABLE_TESTS=${{ (needs.what-to-make.outputs.make-tests == 'true') && 'ON' || 'OFF' }} \
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
-DENABLE_WEB=OFF \
-DENABLE_WERROR=ON \
-DRUN_CLANG_TIDY=OFF
- name: Build
run: cmake --build obj --config RelWithDebInfo
@ -625,6 +630,7 @@ jobs:
-DENABLE_TESTS=${{ (needs.what-to-make.outputs.make-tests == 'true') && 'ON' || 'OFF' }} \
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
-DENABLE_WEB=OFF \
-DENABLE_WERROR=ON \
-DRUN_CLANG_TIDY=OFF
- name: Build
run: cmake --build obj --config RelWithDebInfo

View File

@ -50,6 +50,7 @@ tr_auto_option(ENABLE_MAC "Build Mac client" AUTO)
option(ENABLE_TESTS "Build unit tests" ON)
option(ENABLE_LIGHTWEIGHT "Optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc." OFF)
option(ENABLE_UTP "Build µTP support" ON)
option(ENABLE_WERROR "Treat warnings as errors" OFF)
option(ENABLE_NLS "Enable native language support" ON)
option(INSTALL_DOC "Build/install documentation" ON)
option(INSTALL_LIB "Install the library" OFF)

View File

@ -1,6 +1,9 @@
project(trgtk)
add_compile_options(${C_WARNING_FLAGS})
if(ENABLE_WERROR)
add_compile_options($<IF:$<CXX_COMPILER_ID:MSVC>,/WX,-Werror>)
endif()
execute_process(
COMMAND

View File

@ -41,9 +41,9 @@ private:
#endif
private:
#if GTKMM_CHECK_VERSION(4, 0, 0)
PathButton& widget_;
#if GTKMM_CHECK_VERSION(4, 0, 0)
Glib::Property<Gtk::FileChooser::Action> action_;
Glib::Property<Glib::ustring> title_;
@ -59,9 +59,9 @@ private:
#endif
};
PathButton::Impl::Impl(PathButton& widget)
: widget_(widget)
PathButton::Impl::Impl([[maybe_unused]] PathButton& widget)
#if GTKMM_CHECK_VERSION(4, 0, 0)
: widget_(widget)
, action_(widget, "action", Gtk::FileChooser::Action::OPEN)
, title_(widget, "title", {})
, image_(Gtk::make_managed<Gtk::Image>())