Re: [CMake] Enabling C99 in CMake

2011-06-30 Thread Michael Hertling
On 06/27/2011 07:07 PM, Rolf Eike Beer wrote: > Michael Hertling wrote: > >> SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/c89.c >> PROPERTIES COMPILE_FLAGS ${CMAKE_C_DIALECT_C89}) >> SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/c99.c >> PROPERTIES COMPILE_FLAGS ${CMAKE_C_DIALECT_C99}

Re: [CMake] Enabling C99 in CMake

2011-06-30 Thread Michael Hertling
On 06/27/2011 06:34 PM, Todd Gamblin wrote: > On Jun 24, 2011, at 11:30 PM, Michael Hertling wrote: > >> On 06/23/2011 06:20 PM, Jed Brown wrote: >>> On Thu, Jun 23, 2011 at 17:50, Michael Hertling wrote: >>> You need to use a C99 compiler for your project >>> >>> >>> This is already a probl

Re: [CMake] Enabling C99 in CMake

2011-06-30 Thread Michael Hertling
On 06/26/2011 04:12 PM, Owen Shepherd wrote: > On 25/06/2011 07:30, "Michael Hertling" wrote: > >> On 06/24/2011 04:16 PM, Owen Shepherd wrote: >>> I think the appropriate solution here is a project-specific dialect >>> flag - >>> perhaps one taking options in the GNU format since it seems most >

Re: [CMake] Enabling C99 in CMake

2011-06-27 Thread Todd Gamblin
On Jun 27, 2011, at 10:26 PM, Hendrik Sattler wrote: > Am Montag, 27. Juni 2011, 18:40:19 schrieb Todd Gamblin: >> >> >> I *think* Michael's concern here is that if you have a project that uses >> C99, it should fail as fast as possible, e.g. when it knows that the >> detected/provided compiler

Re: [CMake] Enabling C99 in CMake

2011-06-27 Thread Hendrik Sattler
Am Montag, 27. Juni 2011, 18:40:19 schrieb Todd Gamblin: > On Jun 26, 2011, at 7:12 AM, Owen Shepherd wrote: > > On 25/06/2011 07:30, "Michael Hertling" wrote: > >> On 06/24/2011 04:16 PM, Owen Shepherd wrote: > >>> I think the appropriate solution here is a project-specific dialect > >>> flag - >

Re: [CMake] Enabling C99 in CMake

2011-06-27 Thread Rolf Eike Beer
Michael Hertling wrote: > SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/c89.c > PROPERTIES COMPILE_FLAGS ${CMAKE_C_DIALECT_C89}) > SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/c99.c > PROPERTIES COMPILE_FLAGS ${CMAKE_C_DIALECT_C99}) > ADD_LIBRARY(c89 c89.c) > ADD_LIBRARY(c99 c99.c) >

Re: [CMake] Enabling C99 in CMake

2011-06-27 Thread Todd Gamblin
On Jun 26, 2011, at 7:12 AM, Owen Shepherd wrote: > On 25/06/2011 07:30, "Michael Hertling" wrote: > >> On 06/24/2011 04:16 PM, Owen Shepherd wrote: >>> I think the appropriate solution here is a project-specific dialect >>> flag - >>> perhaps one taking options in the GNU format since it seems

Re: [CMake] Enabling C99 in CMake

2011-06-27 Thread Todd Gamblin
On Jun 24, 2011, at 11:30 PM, Michael Hertling wrote: > On 06/23/2011 06:20 PM, Jed Brown wrote: >> On Thu, Jun 23, 2011 at 17:50, Michael Hertling wrote: >> >>> You need to use a C99 compiler for your project >> >> >> This is already a problem. C99 introduces new keywords (e.g. restrict) and

Re: [CMake] Enabling C99 in CMake

2011-06-26 Thread Owen Shepherd
On 25/06/2011 07:30, "Michael Hertling" wrote: >On 06/24/2011 04:16 PM, Owen Shepherd wrote: >> I think the appropriate solution here is a project-specific dialect >>flag - >> perhaps one taking options in the GNU format since it seems most >>familiar. >> One could perhaps generalise this further

Re: [CMake] Enabling C99 in CMake

2011-06-25 Thread Rolf Eike Beer
Am Samstag, 25. Juni 2011, 08:30:21 schrieb Michael Hertling: > On 06/23/2011 06:20 PM, Jed Brown wrote: > > On Thu, Jun 23, 2011 at 17:50, Michael Hertling wrote: > >> You need to use a C99 compiler for your project > > > > This is already a problem. C99 introduces new keywords (e.g. restrict)

Re: [CMake] Enabling C99 in CMake

2011-06-24 Thread Michael Hertling
On 06/24/2011 12:32 AM, Todd Gamblin wrote: > Thanks to Sean and Jed for useful counterexamples. > > A few more points: > > On Jun 23, 2011, at 8:50 AM, Michael Hertling wrote: > >> While I can understand your point, I'm of a different opinion: In the >> end, it's the responsibility of the user

Re: [CMake] Enabling C99 in CMake

2011-06-24 Thread Michael Hertling
On 06/23/2011 06:20 PM, Jed Brown wrote: > On Thu, Jun 23, 2011 at 17:50, Michael Hertling wrote: > >> You need to use a C99 compiler for your project > > > This is already a problem. C99 introduces new keywords (e.g. restrict) and > removes implicit int. It is entirely possible for part of a p

Re: [CMake] Enabling C99 in CMake

2011-06-24 Thread Michael Hertling
On 06/24/2011 04:16 PM, Owen Shepherd wrote: > On 23/06/2011 23:32, "Todd Gamblin" wrote: >> You could do this, but it seems like a lot of work for the developer AND >> the user compared to my suggestion of just having a variable for the >> compiler-specific C99 flags, or some similar mechanism.

Re: [CMake] Enabling C99 in CMake

2011-06-24 Thread Owen Shepherd
On 23/06/2011 23:32, "Todd Gamblin" wrote: >You could do this, but it seems like a lot of work for the developer AND >the user compared to my suggestion of just having a variable for the >compiler-specific C99 flags, or some similar mechanism. We know an awful >lot of other things about compiler

Re: [CMake] Enabling C99 in CMake

2011-06-23 Thread Todd Gamblin
Thanks to Sean and Jed for useful counterexamples. A few more points: On Jun 23, 2011, at 8:50 AM, Michael Hertling wrote: > While I can understand your point, I'm of a different opinion: In the > end, it's the responsibility of the user to provide the project with a > suitable compiler. If it'

Re: [CMake] Enabling C99 in CMake

2011-06-23 Thread Sean McBride
On Thu, 23 Jun 2011 18:20:46 +0200, Jed Brown said: >> You need to use a C99 compiler for your project > > >This is already a problem. C99 introduces new keywords (e.g. restrict) and >removes implicit int. It is entirely possible for part of a project to >include C89-conforming legacy code that is

Re: [CMake] Enabling C99 in CMake

2011-06-23 Thread Jed Brown
On Thu, Jun 23, 2011 at 17:50, Michael Hertling wrote: > You need to use a C99 compiler for your project This is already a problem. C99 introduces new keywords (e.g. restrict) and removes implicit int. It is entirely possible for part of a project to include C89-conforming legacy code that is n

Re: [CMake] Enabling C99 in CMake

2011-06-23 Thread Michael Hertling
On 06/23/2011 05:09 AM, Todd Gamblin wrote: > On Jun 22, 2011, at 3:46 PM, Michael Hertling wrote: > >> Wouldn't a simple >> >> CC="gcc -std=c99" cmake >> >> for the initial configuration be an appropriate solution? > > I would say no, because whether or not the project is written in C99 or not

Re: [CMake] Enabling C99 in CMake

2011-06-22 Thread Todd Gamblin
On Jun 22, 2011, at 3:46 PM, Michael Hertling wrote: > Wouldn't a simple > > CC="gcc -std=c99" cmake > > for the initial configuration be an appropriate solution? I would say no, because whether or not the project is written in C99 or not isn't something the caller of cmake should have to kno

Re: [CMake] Enabling C99 in CMake

2011-06-22 Thread Michael Hertling
On 06/22/2011 09:32 PM, Todd Gamblin wrote: > Is there a good cross-platform way to enable C99 in a CMake project right > now? You can obviously do this: > > set(CMAKE_C_FLAGS "-std=c99") > > However, that's the GNU way to enable C99, and other compilers do it > differently. It would be

Re: [CMake] Enabling C99 in CMake

2011-06-22 Thread Todd Gamblin
Done. http://www.cmake.org/Bug/view.php?id=12300 On Jun 22, 2011, at 1:08 PM, Sean McBride wrote: > On Wed, 22 Jun 2011 12:32:55 -0700, Todd Gamblin said: > >> Is there a good cross-platform way to enable C99 in a CMake project >> right now? You can obviously do this: >> >> set(CMAKE_C_

Re: [CMake] Enabling C99 in CMake

2011-06-22 Thread Sean McBride
On Wed, 22 Jun 2011 12:32:55 -0700, Todd Gamblin said: >Is there a good cross-platform way to enable C99 in a CMake project >right now? You can obviously do this: > > set(CMAKE_C_FLAGS "-std=c99") > >However, that's the GNU way to enable C99, and other compilers do it >differently. It woul

[CMake] Enabling C99 in CMake

2011-06-22 Thread Todd Gamblin
Is there a good cross-platform way to enable C99 in a CMake project right now? You can obviously do this: set(CMAKE_C_FLAGS "-std=c99") However, that's the GNU way to enable C99, and other compilers do it differently. It would be nice if there were some flags for this set for you in