I have a library using Qt and I am using cppcheck. I do not want to run cppcheck on the resulting ‘autogen’ target, but you can’t set the target properties on the autogen target to disable cppcheck because the target is created (I think) during the generation step of cmake. See code below.
Is there a way to set properties for the Qt autogen targets to disable cppcheck on those targets? Is there another way to keep cppcheck from running on those targets?
set( CMAKE_CXX_CPPCHECK "/path/to/cppcheck" )
add_library( GUI SHARED )
set_target_properties( GUI PROPERTIES AUTORCC TRUE )
target_sources( GUI
PRIVATE
SomeSources.hpp
SomeSources.cpp
# cppcheck can't handle the resultant qrc_*.cpp files
some_resource.qrc
another_resource.qrc
)
# need to disable cppcheck on autogen target, but can't do this
# because GUI_autogen doesn't exist
set_property( TARGET GUI_autogen PROPERTY CXX_CPPCHECK "" )
Are the source file properties for the Qt resource files (.qrc) transitive to the autogen target? It didn’t work for me. The GUI_autogen target still ran the resulting qrc_some_resource.cpp file through cppcheck.