[CMake] incrementally adding source file properties

Eric Noulard eric.noulard at gmail.com
Thu Apr 2 13:19:16 EDT 2009


2009/4/2 Eric Noulard <eric.noulard at gmail.com>:
> 2009/4/2 Bill O'Hara <billtohara at gmail.com>:
>> 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?
>
> What about
> get_source_file_property(OLD_FLAGS foo.c COMPILE_FLAGS)

You should check that do not get "NOTFOUND" because the COMPILE_FLAGS
property is not [yet] defined on the specified file.

> set_source_file_properties(foo.c PROPERTIES COMPILE_FLAGS "${OLD_FLAGS} -g") ?
>
> Should be possible to implement a
>
> update_source_file_properties(...)
>
> which does the job.
>
>
>
> --
> Erk
>



-- 
Erk


More information about the CMake mailing list