This repository was archived by the owner on Apr 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Original file line number Diff line number Diff line change 1- function (get_platform_libraries_from_includes _include_locs _return_var)
1+ #=============================================================================#
2+ # Retrieves all registered platform library names from the given list of names,
3+ # which usually resolves to names of headers included by a source file.
4+ # _names - List of names that possibly contain a registered platform library's name.
5+ # _return_var - Name of variable in parent-scope holding the return value.
6+ # Returns - List of retrieved platform libraries names.
7+ #=============================================================================#
8+ function (get_platform_libraries_from_names _names _return_var)
29
3- set (platform_libs)
4- foreach (include ${_include_locs} )
5- string (REGEX MATCH "[\" <](.+)\\ ." include_name ${include} )
6- set (include_name "${CMAKE_MATCH_1} " )
7- string (TOLOWER "${include_name} " include_name_lower)
8- if ("${include_name_lower} " IN_LIST ARDUINO_CMAKE_PLATFORM_LIBRARIES)
9- list (APPEND platform_libs "${include_name} " )
10- else ()
11- continue ()
10+ foreach (name ${_names} )
11+ string (TOLOWER "${name} " name_lower)
12+ if ("${name_lower} " IN_LIST ARDUINO_CMAKE_PLATFORM_LIBRARIES)
13+ list (APPEND platform_libs "${name} " )
1214 endif ()
1315 endforeach ()
1416
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ function(get_source_file_included_headers _source_file _return_var)
3636
3737 # Extract header names from inclusion
3838 foreach (loc ${source_lines} )
39- string (REGEX MATCH ${ARDUINO_CMAKE_HEADER_NAME_REGEX_PATTERN} ${loc} match )
39+ string (REGEX MATCH ${ARDUINO_CMAKE_HEADER_NAME_REGEX_PATTERN} match ${loc} )
4040 if (headers_WE)
4141 get_name_without_file_extension("${CMAKE_MATCH_1} " header_name)
4242 else ()
Original file line number Diff line number Diff line change @@ -9,15 +9,13 @@ include(ArduinoLibraryParser)
99#=============================================================================#
1010function (find_dependent_platform_libraries _sources _return_var)
1111
12- set (includes)
1312 foreach (source ${_sources} )
14- get_source_file_includes (${source} source_includes)
15- list (APPEND includes ${source_includes} )
13+ get_source_file_included_headers (${source} source_includes WE )
14+ list (APPEND included_headers_names ${source_includes} )
1615 endforeach ()
16+ list (REMOVE_DUPLICATES included_headers_names)
1717
18- list (REMOVE_DUPLICATES includes)
19-
20- get_platform_libraries_from_includes("${includes} " dependent_libs)
18+ get_platform_libraries_from_names("${included_headers_names} " dependent_libs)
2119 set (${_return_var} ${dependent_libs} PARENT_SCOPE)
2220
2321endfunction ()
Original file line number Diff line number Diff line change @@ -70,9 +70,9 @@ endfunction()
7070#=============================================================================#
7171# Extracts a name symbol without possible file extension (marked usually by a dot ('.').
7272# _input_string - String containing name symbol and possibly file extension.
73- # _output_string - Name of a CMake variable that will hold the extraction result.
73+ # _return_var - Name of a CMake variable that will hold the extraction result.
7474#=============================================================================#
75- macro (get_name_without_file_extension _input_string _output_string )
76- string (REGEX MATCH "${ARDUINO_CMAKE_NAME_WE_REGEX_PATTERN} " "${_input_string} " match )
77- set (${_output_string } ${CMAKE_MATCH_1} )
78- endmacro ()
75+ function (get_name_without_file_extension _input_string _return_var )
76+ string (REGEX MATCH "${ARDUINO_CMAKE_NAME_WE_REGEX_PATTERN} " match "${_input_string} " )
77+ set (${_return_var } ${CMAKE_MATCH_1} PARENT_SCOPE )
78+ endfunction ()
You can’t perform that action at this time.
0 commit comments