New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update compiler warning levels #4558
Conversation
c6f6a78
to
4bbbc58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- add new CMake option to documentation
- update MPC build(s)
How do we want to do this? In the configure script? |
docs/devguide/building/index.rst
Outdated
@@ -672,6 +672,13 @@ These are all the variables that are exclusive to building OpenDDS with CMake: | |||
See :ref:`cmake-running-tests` for how to run them. | |||
The default for this is ``TRUE``. | |||
|
|||
.. cmake:var:: OPENDDS_COMPILE_WARNINGS | |||
|
|||
If not empty, enables compiler warnings when compiling OpenDDS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"enables more compiler warnings" ? Aren't some enabled by default either in CMake, its specific Generators, or the compilers themselves?
I think that's a good option |
38dcccd
to
fc9f335
Compare
53faf7b
to
18e5a88
Compare
cmake/opendds_build_helpers.cmake
Outdated
-Wall -Wpedantic -Wno-unused -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy | ||
-Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Woverloaded-virtual | ||
-Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow=5 -Wundef |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating these, what about putting them in a separate file which is read by both CMake and configure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like acetao.ini does now? I don't know if we want to put them there or not though.
cmake/opendds_build_helpers.cmake
Outdated
@@ -18,6 +31,13 @@ function(_opendds_alias target) | |||
add_executable("${name}" ALIAS "${target}") | |||
endif() | |||
set_target_properties(${target} PROPERTIES EXPORT_NAME "${name}") | |||
|
|||
if(OPENDDS_COMPILE_WARNINGS STREQUAL "WARNING" OR OPENDDS_COMPILE_WARNINGS STREQUAL "ERROR") | |||
target_compile_options(${target} PRIVATE ${CMAKE_CXX_COMPILER_ID}-warning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iguessthislldo What is the necessary syntax here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what you want is:
target_compile_options(${target} PRIVATE ${CMAKE_CXX_COMPILER_ID}-warning) | |
target_compile_options(${target} PRIVATE ${${CMAKE_CXX_COMPILER_ID}-warning}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming a space delimited list will be interpreted the same as a normal CMake ;
-delimited list though.
2a96e13
to
b218f22
Compare
See #4550.