[CMake] multi-line definitions
Hi, Is it possible to write variable definition directives using multiple lines, i.e. I have a long definition string such as: SET (CMAKE_C_FLAGS_RELEASE "-mcpu=arm7tdmi -std=gnu99 -fgnu89-inline - finline-functions -ffunction-sections -fdata-sections -fno-strict- aliasing -mno-thumb -Os -s -fomit-frame-pointer -DNDEBUG") How can I split this line (so that it fits into 80 column pages) ? Thanks, Manu ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
Have you tried the following SET (CMAKE_C_FLAGS_RELEASE "-mcpu=arm7tdmi" "-std=gnu99" "-fgnu89-inline" ... "-DNDEBUG") Cyril Emmanuel Blot a écrit : Hi, Is it possible to write variable definition directives using multiple lines, i.e. I have a long definition string such as: SET (CMAKE_C_FLAGS_RELEASE "-mcpu=arm7tdmi -std=gnu99 -fgnu89-inline -finline-functions -ffunction-sections -fdata-sections -fno-strict-aliasing -mno-thumb -Os -s -fomit-frame-pointer -DNDEBUG") How can I split this line (so that it fits into 80 column pages) ? Thanks, Manu ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
cyril_wobow wrote: Have you tried the following SET (CMAKE_C_FLAGS_RELEASE "-mcpu=arm7tdmi" "-std=gnu99" "-fgnu89-inline" ... "-DNDEBUG") Cyril That won't work. It will create a list of items and it needs to be a big string. 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") -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
Am Thursday 18 September 2008 15:18:46 schrieb Bill Hoffman: > cyril_wobow wrote: > > Have you tried the following > > SET (CMAKE_C_FLAGS_RELEASE "-mcpu=arm7tdmi" "-std=gnu99" > > "-fgnu89-inline" ... "-DNDEBUG") > > > > Cyril > > That won't work. It will create a list of items and it needs to be a > big string. Exactly why is it not possible to give a cmake list of options to property like COMPILE_FLAGS and LINK_FLAGS? CMake kindof should know that those flags cannot be given as e.g. "-Wall;-W". Or is there any known case where this would make sense? HS ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
Hendrik Sattler wrote: Am Thursday 18 September 2008 15:18:46 schrieb Bill Hoffman: cyril_wobow wrote: Have you tried the following SET (CMAKE_C_FLAGS_RELEASE "-mcpu=arm7tdmi" "-std=gnu99" "-fgnu89-inline" ... "-DNDEBUG") Cyril That won't work. It will create a list of items and it needs to be a big string. Exactly why is it not possible to give a cmake list of options to property like COMPILE_FLAGS and LINK_FLAGS? CMake kindof should know that those flags cannot be given as e.g. "-Wall;-W". Or is there any known case where this would make sense? Just an oversight. Brad has something in CVS CMake that will allow this. But, for all released versions of CMake, this is how it is. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
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") Ok thanks. Not really handy, but better than nothing ;-) It would be great if CMake supported a true multi-line option, even a basic one like the \ escape char. Cheers, Manu ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
Hi Manu, On Tue, Sep 23, 2008 at 1:54 PM, Emmanuel Blot <[EMAIL PROTECTED]> 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. HTH, George. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
On Tue, Sep 23, 2008 at 11:05 PM, George Neill <[EMAIL PROTECTED]> wrote: > Hi Manu, > > On Tue, Sep 23, 2008 at 1:54 PM, Emmanuel Blot <[EMAIL PROTECTED]> 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. > > > HTH, > George. > ___ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake > ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] multi-line definitions
Yuri >> On Tue, Sep 23, 2008 at 1:54 PM, Emmanuel Blot <[EMAIL PROTECTED]> 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. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake