[CMake] An example of DEFINE_SYMBOL please
Yuri Timenkov
ytimenkov at parallels.com
Mon Jul 7 12:09:12 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.
>
> Any thoughts ?
1) Write with single define symbol. For example, put into some header something
like this:
#ifdef MYTARGET_EXPORTS
#define VALUE1
#define VALUE2
#endif
2) use set_target_properties( target PROPERTIES COMPILE_FLAGS /DVALUE1
/DVALUE2 ).
(According to documentation CMake 2.6 supports this, otherwise set
COMPILE_FLAGS for particular source files).
The latter is not portable, so you have to choose proper flags for every
compiler.
>
> Regards,
> --
> Mehdi
More information about the CMake
mailing list