[CMake] Re: add_definitions & "string" values

Welter Luigi Silva welter at vettalabs.com
Thu Jun 21 08:06:20 EDT 2007


Hi, I didn't figure out how to solve the problem below.
Could someone tell me any solution for that or where I can read about 
handling of literal strings in Cmake scripts, please?
thanks,
Welter

Welter Luigi Silva wrote:
> I'm trying to have a definition with a string value, say, "foo".
> However, when I tried the following command:
>
> add_definitions(-DFOO="foo")
>
> and used FOO in my source file -- in a command like printf("%s\n", 
> FOO) --
> I got 'foo' without the quotes, which is not a valid string literal, 
> as I wished it was.
> I've also tried the command bellow but it did not work as well:
> add_definitions(-DFOO="\"foo\"")
>
> So, how do I define this correctly in a CMakeList.txt file?



More information about the CMake mailing list