Feature request: Add `add_source_files_properties` command
Feature request: Add add_source_files_properties
command. This would append to a property's existing value, if any, rather than overwrite it like set_source_files_properties
does.
I found this useful when adding source file-specific COMPILE_OPTIONS
such as disabling specific warnings on external source files (which are compiled within a target with other source files for warnings should be enabled, so I can't use target_compile_options
). In case there are more similar use cases, adding the command would make users' life easier.
My hand-rolled version:
function(sr_add_source_files_properties files prop value_to_add)
foreach(file ${files})
get_source_file_property(value "${file}" ${prop})
if(value STREQUAL NOTFOUND)
set(value "${value_to_add}")
else()
list(APPEND value "${value_to_add}")
endif()
set_source_files_properties("${file}" PROPERTIES ${prop} "${value}")
endforeach()
endfunction()