This repository was archived by the owner on Apr 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
examples/3rd-party-library Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ function(find_arduino_library _target_name _library_name _board_id)
2121 find_file (library_path
2222 NAMES ${_library_name}
2323 PATHS ${ARDUINO_SDK_LIBRARIES_PATH} ${ARDUINO_CMAKE_SKETCHBOOK_PATH}
24- PATH_SUFFIXES libraries
24+ ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}
25+ PATH_SUFFIXES libraries dependencies
2526 NO_DEFAULT_PATH
2627 NO_CMAKE_FIND_ROOT_PATH )
2728
@@ -34,6 +35,7 @@ function(find_arduino_library _target_name _library_name _board_id)
3435
3536 if (NOT library_headers)
3637 message (SEND_ERROR "Couldn't find any header files for the ${_library_name} library" )
38+
3739 else ()
3840
3941 if (parsed_args_HEADER_ONLY)
@@ -48,14 +50,19 @@ function(find_arduino_library _target_name _library_name _board_id)
4850 "${_library_name} library - Is it a header-only library?"
4951 "If so, please pass the HEADER_ONLY option "
5052 "as an argument to the function" )
53+
5154 else ()
55+
5256 set (sources ${library_headers} ${library_sources} )
5357
5458 add_arduino_library(${_target_name} ${_board_id} ${sources} )
59+
5560 endif ()
5661
5762 endif ()
63+
5864 endif ()
65+
5966 endif ()
6067
6168 unset (library_path CACHE )
Original file line number Diff line number Diff line change @@ -12,9 +12,7 @@ target_include_directories(3rd_Party_Arduino_Library PRIVATE include)
1212add_arduino_library(adafruit_NeoPixel ${board_id} libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.cpp)
1313target_include_directories (adafruit_NeoPixel PUBLIC libraries/Adafruit_NeoPixel)
1414
15- # Find the "GFX" library by 'tricking' the framework to use current directory as the Sketchbook path,
16- # allowing us to use the 'find' API
17- set (ARDUINO_CMAKE_SKETCHBOOK_PATH "${CMAKE_CURRENT_LIST_DIR} " )
15+ # Find the "GFX" library - It's located under the 'libraries' sub-dir, which is a valid search path
1816find_arduino_library(adafruit_GFX Adafruit-GFX-Library ${board_id} 3RD_PARTY)
1917# We can also explicitly add additional directories to the target,
2018# as only root dir and 'src' and 'utility' sub-dirs are added by default
You can’t perform that action at this time.
0 commit comments