From 8b415c8d156739062f37c856a8457e83d1d60509 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Mon, 6 Jun 2022 20:08:10 +0300 Subject: [PATCH 1/2] Improved library search: now properties ending with `architectures` are ignored. --- Arduino/System/BoardBuildTargets.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arduino/System/BoardBuildTargets.cmake b/Arduino/System/BoardBuildTargets.cmake index b61f19a..8cb52a5 100644 --- a/Arduino/System/BoardBuildTargets.cmake +++ b/Arduino/System/BoardBuildTargets.cmake @@ -861,8 +861,8 @@ function(_library_search_process lib search_paths_var search_suffixes_var return # message("Folder match ${lib}:${dir}:${folder_name_priority}") # Check for architecture match - file(STRINGS "${dir}/library.properties" arch_str REGEX "architectures=.*") - string(REGEX MATCH "architectures=(.*)" arch_list "${arch_str}") + file(STRINGS "${dir}/library.properties" arch_str REGEX "^architectures=.*") + string(REGEX MATCH "^architectures=(.*)" arch_list "${arch_str}") string(REPLACE "," ";" arch_list "${CMAKE_MATCH_1}") string(TOUPPER "${ARDUINO_BOARD_BUILD_ARCH}" board_arch) From e58fb50694382771ff65500d43498cf4828a0932 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Mon, 6 Jun 2022 20:15:24 +0300 Subject: [PATCH 2/2] Fixed broken library discovery: header file can have another name. --- Arduino/System/BoardBuildTargets.cmake | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Arduino/System/BoardBuildTargets.cmake b/Arduino/System/BoardBuildTargets.cmake index 8cb52a5..b2936fe 100644 --- a/Arduino/System/BoardBuildTargets.cmake +++ b/Arduino/System/BoardBuildTargets.cmake @@ -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)