src/CMakeLists: Reduced code duplication with ADD_CUSTOM_COMMAND