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 +28
-6
lines changed Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ include(MathUtils)
1212include (ListUtils)
1313include (StringUtils)
1414include (PropertyUtils)
15+ include (PlatformLibraryUtils)
1516
1617include (BoardManager)
1718include (RecipeParser)
Original file line number Diff line number Diff line change @@ -35,16 +35,18 @@ function(resolve_sketch_headers _target_name _board_id _sketch_file)
3535 # So first we should check whether it's a library
3636 get_name_without_file_extension("${header} " header_we)
3737
38- if (${header_we} IN_LIST ARDUINO_CMAKE_PLATFORM_LIBRARIES)
39- link_platform_library(${_target_name} ${header_we} ${_board_id} )
38+ is_platform_library(${header_we} is_header_platform_lib)
39+ if (is_header_platform_lib)
40+ string (TOLOWER ${header_we} header_we_lower)
41+ link_platform_library(${_target_name} ${header_we_lower} ${_board_id} )
4042 else ()
4143 find_arduino_library(${header_we} _sketch_lib ${header_we} ${_board_id} )
4244 # If library isn't found, display a wraning since it might be a user library
43- if (NOT ${header_we} _sketch_lib OR "${${header_we} _sketch_lib}" MATCHES "NOTFOUND" )
45+ if (NOT TARGET ${header_we} _sketch_lib OR "${${header_we} _sketch_lib}" MATCHES "NOTFOUND" )
4446 _validate_target_includes_header(${_target_name} ${header} is_header_validated)
4547 if (NOT is_header_validated)
4648 # Header hasn't been found in any of the target's include directories, Display warning
47- message (WARNING "The header '${_header } ' is used by the \
49+ message (WARNING "The header '${header_we } ' is used by the \
4850 '${_sketch_file} ' sketch \
4951 but it isn't a Arduino/Platform library, nor it's linked \
5052 to the target manually!" )
Original file line number Diff line number Diff line change 1- include (ArduinoLibraryParser)
2-
31#=============================================================================#
42# Looks for any platform libraries (Resolved earlier when platform has been initialized)
53# within the given sources and returns them in a list.
Original file line number Diff line number Diff line change 1+ #=============================================================================#
2+ # Checks whether the given name resolves to one of the platform libraries' names.
3+ # _name - Name to check.
4+ # _return_var - Name of variable in parent-scope holding the return value.
5+ # Returns - True if name resolves to a platform library's name, false otherwise.
6+ #=============================================================================#
7+ function (is_platform_library _name _return_var)
8+
9+ string (TOLOWER "${_name} " name_lower)
10+ if ("${name_lower} " IN_LIST ARDUINO_CMAKE_PLATFORM_LIBRARIES)
11+ set (lib_found TRUE )
12+ else ()
13+ set (lib_found FALSE )
14+ endif ()
15+
16+ set (${_return_var} ${lib_found} PARENT_SCOPE)
17+
18+ endfunction ()
19+
120#=============================================================================#
221# Retrieves all registered platform library names from the given list of names,
322# which usually resolves to names of headers included by a source file.
827function (get_platform_libraries_from_names _names _return_var)
928
1029 foreach (name ${_names} )
30+ # Can't use `is_platform_library` function since it returns just a boolean
1131 string (TOLOWER "${name} " name_lower)
1232 if ("${name_lower} " IN_LIST ARDUINO_CMAKE_PLATFORM_LIBRARIES)
1333 list (APPEND platform_libs "${name} " )
@@ -17,3 +37,4 @@ function(get_platform_libraries_from_names _names _return_var)
1737 set (${_return_var} ${platform_libs} PARENT_SCOPE)
1838
1939endfunction ()
40+
You can’t perform that action at this time.
0 commit comments