queezythegreat / arduino-cmake

Arduino CMake Build system
648 stars 216 forks source link

ARDUINO_SDK_PATH environment variable not working #79

Closed John-RB closed 10 years ago

John-RB commented 10 years ago

ArduinoToolchain.cmake is not picking up the contents of environment variable ARDUINO_SDK_PATH.

One possible method to fix this is to add the following after line 69:

allow override of ARDUINO_SDK_PATH, eg: set ARDUINO_SDK_PATH=c:\program files\arduino (WITHOUT quotes)

if(DEFINED ENV{ARDUINO_SDK_PATH}) set(ARDUINO_SDK_PATH $ENV{ARDUINO_SDK_PATH}) endif()

John

queezythegreat commented 10 years ago

Hi, Arduino-CMake does not look at environment variables. Usually you would do the following:

cmake -DARDUINO_SDK_PATH=C:\path\to\cmake PATH_TO_SOURCES

It is a nice idea to look at the environment for some options, I'll think about adding this functionality in the future.

John-RB commented 10 years ago

When I first ran Arduino-CMake after installing a new version of Arduino (1.0.5) I received the following error message:

FATAL_ERROR "Could not find Arduino SDK (set ARDUINO_SDK_PATH)!

which was generated by the following code at lines 71-76 of ArduinoToolchain.cmake shown below

if(ARDUINO_SDK_PATH) list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr/bin) list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr/utils/bin) else() message(FATAL_ERROR "Could not find Arduino SDK (set ARDUINO_SDK_PATH)!") endif()

When I saw the the word "set" I was assuming it was expected that someone had issued the DOS "SET" command to provide the path to the SDK in an environment variable named ARDUINO_SDK_PATH.

I did the DOS set and things still did not work so I figured out how to use the environment variable and included that information in my issue.

It was use of the word "set" in the error message that lead me to believe that Arduino-CMake was expecting to find an environment variable named ARDUINO_SDK_PATH.

John

On 2/9/2014 9:48 PM, Tomasz Bogdal wrote:

Hi, Arduino-CMake does not look at environment variables. Usually you would do the following:

cmake -DARDUINO_SDK_PATH=C:\path\to\cmake PATH_TO_SOURCES

It is a nice idea to look at the environment for some options, I'll think about adding this functionality in the future.

— Reply to this email directly or view it on GitHub https://github.com/queezythegreat/arduino-cmake/issues/79#issuecomment-34597175.