You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
I ported a code base from qmake to cmake and have started cleaning up compiler warnings. In doing so, I noticed that the cpp files generated by QT's Automoc triggers warnings on -Wundefined-reinterpret-cast and -Wuseless-cast.
There isn't much that can be done to fix the warnings since the code is autogenerated by qt. Since I reference this repo for handy defaults I thought I would post this to see if it would help others as a good default.
To fix this in my project I added the following lines to my CMake file:
# Ignore warnings related to autogenerated code from MOC
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/[project_name]_autogen/mocs_compilation.cpp PROPERTIES COMPILE_FLAGS "-Wno-undefined-reinterpret-cast")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/[project_name]_autogen/mocs_compilation.cpp PROPERTIES COMPILE_FLAGS "-Wno-useless-cast")
The text was updated successfully, but these errors were encountered:
The solution you posted unfortunately doesn't seem to work for me (with clang). Maybe I just did it wrong. What helped me was to "kind of" disable clang-tidy on those files, more or less like it was done here: Kitware/CMake@b13bc86
I ported a code base from qmake to cmake and have started cleaning up compiler warnings. In doing so, I noticed that the cpp files generated by QT's Automoc triggers warnings on -Wundefined-reinterpret-cast and -Wuseless-cast.
There isn't much that can be done to fix the warnings since the code is autogenerated by qt. Since I reference this repo for handy defaults I thought I would post this to see if it would help others as a good default.
To fix this in my project I added the following lines to my CMake file:
The text was updated successfully, but these errors were encountered: