[CMake] multi-line definitions
George Neill
georgen at neillnet.com
Wed Sep 24 11:27:03 EDT 2008
Yuri
>> On Tue, Sep 23, 2008 at 1:54 PM, Emmanuel Blot <eblotml at free.fr> wrote:
>> >> The only way would be something like this:
>> >>
>> >> set(a "-mcpu=arm7tdmi -std=gnu99 -fgnu89-inline -finline-functions")
>> >> set(a "${a} -ffunction-sections -fdata-sections ")
>> >> set(a "${a} -fno-strict-aliasing -mno-thumb -Os -fomit-frame-pointer")
>>
>> I use a list.
>>
>> SET(MY_C_FLAGS
>> -O3
>> -m32
>> -DNDEBUG
>> -D_LARGEFILE_SOURCE
>> -D_FILE_OFFSET_BITS=64
>> -s # strip debug symbols
>> )
>>
>> Then turn it into a string later, I haven't ran into any issues doing
>> it this way yet.
>
> But this turns into list (in terms of cmake) that is string with
> semicolon-separated elements (not space-separated).
> And this may be a problem in some cases, and initial compile flags seems to
> be the case.
I have a macro which iterates over the "list" (semi-colon separated)
and turns it in to a "string" (space separated). I haven't had any
troubles. It is possible you might run into troubles if you need to
have quotes or something like that in your compile options, but I
haven't run in to that case yet. Hope that makes sense.
Later,
George.
More information about the CMake
mailing list