[CMake] An example of DEFINE_SYMBOL please

Yuri Timenkov ytimenkov at parallels.com
Thu Jul 10 06:43:51 EDT 2008



On Monday 07 July 2008 19:59:24 Mehdi Rabah wrote:
> Hi,
>
> I need to set multiple symbols in one of my target of my project. I can't
> use add_definitions because I don't want to define those variable for all
> my targets, so I tried custom properties.
>
> set_target_properties( target PROPERTIES DEFINE_SYMBOL  VALUE1 VALUE2 )
> doesn't work : the function doesn't expect this number of variables.
>
> if I try :
>
> set( var "VALUE1 VALUE2" ).
> set_target_properties( target PROPERTIES DEFINE_SYMBOL  ${var} )
>
> I get
>
> c1xx : fatal error C1083: 'VALUE2': No such file or directory
>
> I'm working with the microsoft compiler, and cmake 2.6.
I just discovered nice feature: COMPILE_DEFINITIONS property.
That is you can add custom defines to source files, targets or directories (with 
commands set_source_files_properties, set_target_properties and 
set_directory_properties commands accordingly).

Moreover, COMPILE_DEFINITIONS can be configuration-specific, like 
COMPILE_DEFINITIONS_DEBUG.

>
> Any thoughts ?
>
> Regards,
> --
> Mehdi



More information about the CMake mailing list