Compiler warnings from boost headers stops compilation
Summary
Warnings from boost headers result in compilation error.
Steps to reproduce
System specifications:
Host OS System: Darwin-14.5.0
The C++ compiler identification is: AppleClang
The C++ compiler version is: 7.0.2.7000181
Boost version: 1.66.0
What is the current bug behavior?
Compiler warnings from boost files result in compilation error.
What is the expected correct behavior?
Boost or dependent libraries should not trigger compiler errors.
Relevant logs and/or screenshots
In file included from /Users/jsnuverink/Documents/OPAL/fork/src/src/Distribution/Distribution.cpp:10:
In file included from /Users/jsnuverink/Documents/OPAL/fork/src/src/Distribution/SigmaGenerator.h:37:
In file included from /opt/local/include/boost/numeric/ublas/matrix_sparse.hpp:16:
In file included from /opt/local/include/boost/numeric/ublas/vector_sparse.hpp:16:
/opt/local/include/boost/numeric/ublas/storage_sparse.hpp:401:35: error: unused parameter
'hint' [-Werror,-Wunused-parameter]
iterator insert (iterator hint, const value_type &p) {
^
Possible fixes
Include the boost headers as system headers so that gcc and clang don't issue warnings (with -isystem
)
In CMake this can be done with:
include_directories (SYSTEM ${Boost_INCLUDE_DIRS})
As a side note it seems include_directories
is deprecated and it is advised to use target_include_directories
instead.