Index: lib/MsgUtils/cmake/MsgUtils.cmake =================================================================== diff -u -r64243101dff61b5c1a40b96ef33080236999acf6 -r4dccc470aedf6f68a0ad73c1101f8a96188cbdb1 --- lib/MsgUtils/cmake/MsgUtils.cmake (.../MsgUtils.cmake) (revision 64243101dff61b5c1a40b96ef33080236999acf6) +++ lib/MsgUtils/cmake/MsgUtils.cmake (.../MsgUtils.cmake) (revision 4dccc470aedf6f68a0ad73c1101f8a96188cbdb1) @@ -93,6 +93,14 @@ ) add_custom_target(${_target_name} DEPENDS ${_output_ini}) + + # CMake adds every custom-command OUTPUT to the clean target. Unlike the other + # generated files, this INI is persistent, so a clean must not delete it. + # CMake offers no per-output exemption, so the directory-scoped property is required, + # but a side effect is that the calling directory must not rely on clean removing other + # custom outputs in this directory. It is ok for now since the _output_ini is the only + # file in the directory, but may need to be addressed later if more files are added. + set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM TRUE) endfunction() # \brief This function adds a custom command to generate a Protobuf file from inputted message conf files