PATCH Add compilation options for libraries


I have problem to compile a library for arduino that is C99 compliant I've seen many persons avoiding this problem by just renaming *.c files in *.cpp, and C++ accepts some C99 extension. This technique is crappy...

I think it would be very good to add the possibility to add some compilation options for library (library can be cpp files or c files)

A patch would be (I think)

--- 2009-03-19 16:59:11.000000000 +0100 +++ 2009-03-19 16:57:45.000000000 +0100 @@ -335,6 +335,7 @@ "-g", "-Os", "-Wall", + Preferences.get("library_avr_gcc_options"), "-ffunction-sections", // place each function in its own section "-fdata-sections", "-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"), @@ -349,6 +350,7 @@ "-g", "-Os", "-Wall", + Preferences.get("library_avr_g++_options"), "-fno-exceptions", "-ffunction-sections", // place each function in its own section "-fdata-sections",

and then I could add library_avr_gcc_options="std=c99" in my preferences.txt file

Would be nice to have this feature added (i've seen many -std=gnu99 in several Makefile in arduino, which is C99 + extensions, would be good to have the same liberty in the compilation of libraries)


Does this work if you want to specify multiple (space-separated) options in the preference?

On the LEDuino our CAN bus support requires use of the 'magic' -std=gnu99 option. We have been using a hacked version of Arduino 0013 and this has worked. However it does limit us if we need to hack the IDE each time a new version makes its way into the wild.

Perhaps support for this should be added to the maintream IDE?


It seams like this would be much more valuable if the options could be added at the sketch level rather than in the general preferences. This way you could add additional options only when you need them for a particular sketch/library/etc.

Maybe a pseudo compiler directive that is interpreted by the IDE's pre-processor?