diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1c5de1a14..10f5c09ae 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0267368e3..1bee0603b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index 634c05a9c..b8c57881f 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -1,6 +1,9 @@ project(trgtk) add_compile_options(${C_WARNING_FLAGS}) +if(ENABLE_WERROR) + add_compile_options($,/WX,-Werror>) +endif() execute_process( COMMAND diff --git a/gtk/PathButton.cc b/gtk/PathButton.cc index c2005e845..7c7e6d6df 100644 --- a/gtk/PathButton.cc +++ b/gtk/PathButton.cc @@ -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 action_; Glib::Property 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())