Skip to content

Commit 24f9354

Browse files
committed
Fix broken library discovery. Merged: a9183756-gh#57
1 parent b01177e commit 24f9354

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Arduino/System/BoardBuildTargets.cmake

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,8 @@ function(_library_search_process lib search_paths_var search_suffixes_var return
861861
# message("Folder match ${lib}:${dir}:${folder_name_priority}")
862862

863863
# Check for architecture match
864-
file(STRINGS "${dir}/library.properties" arch_str REGEX "architectures=.*")
865-
string(REGEX MATCH "architectures=(.*)" arch_list "${arch_str}")
864+
file(STRINGS "${dir}/library.properties" arch_str REGEX "^architectures=.*")
865+
string(REGEX MATCH "^architectures=(.*)" arch_list "${arch_str}")
866866
string(REPLACE "," ";" arch_list "${CMAKE_MATCH_1}")
867867
string(TOUPPER "${ARDUINO_BOARD_BUILD_ARCH}" board_arch)
868868

@@ -916,11 +916,18 @@ function(_library_search_process lib search_paths_var search_suffixes_var return
916916
endif()
917917

918918
# Although we got the match, let us search for the required header within the folder
919-
file(GLOB_RECURSE lib_header_path "${matched_lib_path}/${lib}.h*")
920-
if (NOT lib_header_path)
921-
set ("${return_var}" "${lib}-NOTFOUND" PARENT_SCOPE)
922-
return()
923-
endif()
919+
file(STRINGS "${matched_lib_path}/library.properties" incl_list REGEX "^includes=.*")
920+
string(REGEX MATCH "^includes=(.*)" incl_list "${arch_str}")
921+
string(REPLACE "," ";" incl_list "${CMAKE_MATCH_1}")
922+
923+
foreach(h ${incl_list})
924+
file(GLOB_RECURSE lib_header_path "${matched_lib_path}/${h}.h*")
925+
if (NOT lib_header_path)
926+
message(STATUS "Header ${h} for ${lib} is not found.")
927+
set ("${return_var}" "${lib}-NOTFOUND" PARENT_SCOPE)
928+
return()
929+
endif()
930+
endforeach()
924931

925932
set ("${return_var}" "${matched_lib_path}" PARENT_SCOPE)
926933

0 commit comments

Comments
 (0)