[CMake] "COMPILE_DEFINITIONS"

Alexander Neundorf a.neundorf-work at gmx.net
Wed Mar 11 15:47:42 EDT 2009


On Wednesday 11 March 2009, Steven Van Ingelgem wrote:
> Hi all,
>
>
> How can I add multiple "COMPILE_DEFINITIONS" for 1 source file?
> I tried with a foreach loop, I tried with an array to
> "COMPILE_DEFINITIONS". In the first case, the latest is retained, in the
> last case only the first one is set.

I can think of the following ways:

use SET_PROPERTY(SOURCE ... ) with the APPEND argument, or

first use GET_SOURCE_FILE_PROPERTY() to get the current value, then append the 
new value to the variable, and then set the new value using 
SET_SOURCE_FILES_PROPERTIES().

Make sure to use quuotes around the dereferenced variable:
SET_SOURCE_FILES_PROPERTIES(.... "${my_list_of_stuff}" ).

Please post the code if it doesn't work.

Alex


More information about the CMake mailing list