Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit 5d6fc5c

Browse files
committed
Modified SDK-Finding process to find SDK's version file.
It's located at 'lib/version.txt' for all OSs, unlike the 'arduino' program searched before, which was different for MacOS.
1 parent 4991c2e commit 5d6fc5c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

cmake/Arduino-Toolchain.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include(${CMAKE_CURRENT_LIST_DIR}/Platform/Other/FindArduinoSDK.cmake)
1+
include(${CMAKE_CURRENT_LIST_DIR}/Platform/Other/ArduinoSDKSeeker.cmake)
22

33
function(_find_required_programs)
44

cmake/Platform/Other/FindArduinoSDK.cmake renamed to cmake/Platform/Other/ArduinoSDKSeeker.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#=============================================================================#
2+
# Attempts to find the Arduino SDK in the host system, searching at known locations.
3+
# For each host OS the locations are different, however, eventually they all search for the
4+
# 'lib/version.txt' file, which is located directly under the SDK directory under ALL OSs.
5+
# _return_var - Name of variable in parent-scope holding the return value.
6+
# Returns - Path to the found Arudino SDK.
7+
#=============================================================================#
18
function(find_arduino_sdk _return_var)
29

310
if (${CMAKE_HOST_UNIX})
@@ -12,20 +19,19 @@ function(find_arduino_sdk _return_var)
1219
set(platform_search_paths "C:/Program Files (x86)/Arduino" "C:/Program Files/Arduino")
1320
endif ()
1421

15-
find_program(arduino_program_path
16-
NAMES arduino
22+
find_path(ARDUINO_SDK_PATH
23+
NAMES lib/version.txt
1724
HINTS ${platform_search_paths}
1825
NO_DEFAULT_PATH
1926
NO_CMAKE_FIND_ROOT_PATH)
20-
get_filename_component(sdk_path "${arduino_program_path}" DIRECTORY)
2127

22-
if (NOT sdk_path OR "${sdk_path}" MATCHES "NOTFOUND")
28+
if (${ARDUINO_SDK_PATH} MATCHES "NOTFOUND")
2329
string(CONCAT error_message
2430
"Couldn't find Arduino SDK path - Is it in a non-standard location?" "\n"
2531
"If so, please set the ARDUINO_SDK_PATH CMake-Variable")
2632
message(FATAL_ERROR ${error_message})
2733
else ()
28-
set(${_return_var} "${sdk_path}" PARENT_SCOPE)
34+
set(${_return_var} "${ARDUINO_SDK_PATH}" PARENT_SCOPE)
2935
endif ()
3036

3137
endfunction()

0 commit comments

Comments
 (0)