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:
And then for a source file
foo.c the output would be
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.