After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792883 - cmake: no way to turn off -Werror
cmake: no way to turn off -Werror
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Build system
2.7.x
Other NetBSD
: Normal normal
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2018-01-24 22:39 UTC by Thomas Klausner
Modified: 2018-06-30 00:03 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Thomas Klausner 2018-01-24 22:39:36 UTC
With configure, there was --disable-error-on-warning, but I can't find a similar setting for cmake.

The build fails for me on NetBSD-8.99.12/amd64 with boost-1.66.0 with:

  In file included from /scratch/wip/gnucash-devel/work/.buildlink/include/boost/locale.hpp:17:0,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp:11:
/scratch/wip/gnucash-devel/work/.buildlink/include/boost/locale/format.hpp:124:22: error: 'template<class> class std::auto_ptr' is deprecated [-Werror=deprecated-declarations]
                 std::auto_ptr<data> d;                                 
                      ^                                          
In file included from /usr/include/g++/memory:81:0,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-tokenizer.hpp:46,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.hpp:45,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp:1:
/usr/include/g++/bits/unique_ptr.h:49:28: note: declared here       
   template<typename> class auto_ptr;                           
                            ^
In file included from /scratch/wip/gnucash-devel/work/.buildlink/include/boost/locale.hpp:19:0,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp:11:
/scratch/wip/gnucash-devel/work/.buildlink/include/boost/locale/generator.hpp:223:18: error: 'template<class> class std::auto_ptr' is deprecated [-Werror=deprecated-declarations]
             std::auto_ptr<data> d;
                  ^
In file included from /usr/include/g++/memory:81:0,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-tokenizer.hpp:46,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.hpp:45,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp:1:
/usr/include/g++/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^
In file included from /scratch/wip/gnucash-devel/work/.buildlink/include/boost/locale.hpp:22:0,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp:11:
/scratch/wip/gnucash-devel/work/.buildlink/include/boost/locale/localization_backend.hpp:107:18: error: 'template<class> class std::auto_ptr' is deprecated
+[-Werror=deprecated-declarations]
             std::auto_ptr<localization_backend> get() const;
                  ^
In file included from /usr/include/g++/memory:81:0,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-tokenizer.hpp:46,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.hpp:45,
                 from /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/csv-imp/gnc-csv-tokenizer.cpp:1:
/usr/include/g++/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^
...
Comment 1 John Ralls 2018-01-25 01:28:23 UTC
You can always add your own flags with -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS. CMake will fill those in from $CFLAGS and $CXXFLAGS in the environment if they're defined and you don't explicitly pass the cmake flags. Note that cmake *doesn't* look at $CPPFLAGS and doesn't have an equivalent. As currently written CMakeLists.txt puts them in front (which is bad, that way you can't override the ones supplied by CMakeLists.txt) but you can still turn off the deprecation warning with -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations".

CMakeLists.txt already does that for CMAKE_CXX_FLAGS_DEBUG and that's also wrong.
Comment 2 Thomas Klausner 2018-01-25 09:05:25 UTC
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"
works around the problem.
I still claim that the build system should not add -Werror, but the workaround is good enough for me.
Comment 3 John Ralls 2018-02-13 22:17:24 UTC
I've rearranged the commands which add flags to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS so that command-line provided values will come after the ones set in CMakeLists.txt. That will allow you to pass -DCMAKE_C_FLAGS="-Wno-error" -DCMAKE_CXX_FLAGS="-Wno-error" to disable error-on-warning if you like.
Comment 4 John Ralls 2018-06-30 00:03:45 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=792883. Please update any external references or bookmarks.