a9183756-gh / Arduino-CMake-Toolchain

CMake toolchain for all Arduino compatible boards
MIT License
135 stars 40 forks source link

No compiler warnings? Can compiler flags be set on a by-target basis? #56

Closed connorfuhrman closed 2 years ago

connorfuhrman commented 2 years ago

Potential bug? I don't see any compiler warnings even though I expect some.

Is there a way to set compiler flags either globally or on a per-target basis? And is it expected to not see anything from a #pragma message directive?

I've attempted to use the following:

However when I have an unused and uninitialized variable, e.g.,

void loop() {
   int x;
}

I see no warnings.

And even when attempting either the #pragma message "test" or #warning "test" I don't see any warnings printed to the screen. Switching to #error "test" triggers a compile-time error and shows the message.

Output from CMake config shown below running on MacOS 12.2 using Arduino SDK 1.8.19:

/Applications/Arduino.app/Contents/Java
-- Found Arduino Platform: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr
-- Found Arduino Platform: /Users/connorfuhrman/Library/Arduino15/packages/esp32/hardware/esp32/2.0.0
-- Selected Arduino Board: Arduino Uno [avr.uno]
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc
-- Found Arduino Library TimerInterrupt: /Users/connorfuhrman/Documents/Arduino/libraries/TimerInterrupt
-- Configuring done
-- Generating done
-- Build files have been written to: /path/to/my/project
connorfuhrman commented 2 years ago

May have jumped the gun on this one... Editing the platform.txt file from the Arduino IDE application folder seems to be working.

connorfuhrman commented 2 years ago

Sorry for the spam this issue is resolved by editing the Arduino platform.txt file for me!