Skip to content

Commit e58fb50

Browse files
committed
Fixed broken library discovery: header file can have another name.
1 parent 8b415c8 commit e58fb50

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Arduino/System/BoardBuildTargets.cmake

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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)