Skip to content

Commit

Permalink
Fixed broken library discovery: header file cna have another name.
Browse files Browse the repository at this point in the history
  • Loading branch information
KOLANICH committed Jun 6, 2022
1 parent 8b415c8 commit 2048b77
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Arduino/System/BoardBuildTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -916,11 +916,18 @@ function(_library_search_process lib search_paths_var search_suffixes_var return
endif()

# Although we got the match, let us search for the required header within the folder
file(GLOB_RECURSE lib_header_path "${matched_lib_path}/${lib}.h*")
if (NOT lib_header_path)
set ("${return_var}" "${lib}-NOTFOUND" PARENT_SCOPE)
return()
endif()
file(STRINGS "${matched_lib_path}/library.properties" incl_list REGEX "^includes=.*")
string(REGEX MATCH "^includes=(.*)" incl_list "${arch_str}")
string(REPLACE "," ";" incl_list "${CMAKE_MATCH_1}")

foreach(h ${incl_list})
file(GLOB_RECURSE lib_header_path "${matched_lib_path}/${h}.h*")
if (NOT lib_header_path)
message(STATUS "Header ${h} for ${lib} is not found.")
set ("${return_var}" "${lib}-NOTFOUND" PARENT_SCOPE)
return()
endif()
endforeach()

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

Expand Down

0 comments on commit 2048b77

Please sign in to comment.