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

Commit b8e05c2

Browse files
committed
Added Sketchbook path to list of search paths used to find an arduino library.
1 parent d87dc5e commit b8e05c2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cmake/Platform/Targets/ArduinoLibraryTarget.cmake

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,18 @@ function(find_arduino_library _target_name _library_name _board_id)
102102
if (NOT find_lib_3RD_PARTY)
103103
convert_string_to_pascal_case(${_library_name} _library_name)
104104
endif ()
105-
set(library_path "${ARDUINO_SDK_LIBRARIES_PATH}/${_library_name}")
106-
set(library_properties_path "${library_path}/library.properties")
107105

108-
if (NOT EXISTS "${library_properties_path}")
106+
find_file(library_properties_file library.properties
107+
PATHS ${ARDUINO_SDK_LIBRARIES_PATH} ${ARDUINO_CMAKE_SKETCHBOOK_PATH}/libraries
108+
PATH_SUFFIXES ${_library_name}
109+
NO_DEFAULT_PATH
110+
NO_CMAKE_FIND_ROOT_PATH)
111+
112+
if (${library_properties_file} MATCHES "NOTFOUND")
109113
message(SEND_ERROR "Couldn't find library named ${_library_name}")
110114
else () # Library is found
111-
_get_library_architecture("${library_properties_path}" lib_arch)
115+
get_filename_component(library_path ${library_properties_file} DIRECTORY)
116+
_get_library_architecture("${library_properties_file}" lib_arch)
112117
if (lib_arch)
113118
if ("${lib_arch}" MATCHES "UNSUPPORTED")
114119
string(CONCAT error_message
@@ -140,6 +145,8 @@ function(find_arduino_library _target_name _library_name _board_id)
140145
endif ()
141146
endif ()
142147

148+
unset(library_properties_file CACHE)
149+
143150
endfunction()
144151

145152
#=============================================================================#

0 commit comments

Comments
 (0)