[CMake] incrementally adding source file properties

Tobias Rudolph tobias.rudolph at artorg.unibe.ch
Thu Apr 2 13:27:30 EDT 2009


On 2 Apr 2009, at 19:12, Bill O'Hara wrote:

> Is it possible to incrementally add new properties to source files?  
> In two parts of a large build there are cases where it'd be very  
> convenient to be able to do this:
>
> set_source_file_properties(foo.c PROPERTIES COMPILE_FLAGS "-m32")
> set_source_file_properties(foo.c PROPERTIES COMPILE_FLAGS "-g")
>
> and have the properties be "-m32 -g". Right now it seems to instead  
> just set it to "-g" and there seems not to be a way to read the  
> properties and use the existing value as part of a new string?
>
> There isn't always a place to definitively set the properties so its  
> not an option right now to build up the options in a separate  
> variable and just do the set_source_file_properties once.
>
> thanks
> b.

Just use "set_property( SOURCE ..." - it has an APPEND option which  
will do the trick.

--tobias


More information about the CMake mailing list