Skip to content

Support file specifc properties for CMAKE_<LANG>_CPPCHECK

Support file specific properties for CMAKE__CPPCHECK and friends. So e.g. redirectoring the output of cppcheck into a specific file is possible easily. It might work via generator expressions:

set(CMAKE_C_CPPCHECK "cppcheck;--output-file=$<TARGET_PROPERTY:OUTPUT_NAME>.cppcheck")

And then for a source file foo.c the output would be foo.o.ccppcheck

See also the discussion at https://discourse.cmake.org/t/parallel-cppcheck-invocation-corrupts-common-output-file/3071/6 and also #21986 which might share needed building blocks.

Concerning the generator expression I could not find anything in https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html that works here. Using $<TARGET_PROPERTY:OUTPUT_NAME> seem wrong semantically, as we are not dealing with a target here necessarily, but just an artifact needed for a target. It might be the target in some simple project, if there is only one artifact that is generated.

Edited by Axel Heider
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information