1- #=============================================================================#
2- # Attempts to retrieve a library's properties file based on its' root directory.
3- # If couldn't be found, CMake generates a warning and returns an empty string.
4- # _library_root_directory - Path to library's root directory. Can be relative.
5- # _return_var - Name of variable in parent-scope holding the return value.
6- # Returns - Full path to library's properties file.
7- #=============================================================================#
8- function(_get_library_properties_file _library_root_directory _return_var)
9-
10- # Get the absolute root directory (full path)
11- get_filename_component(absolute_lib_root_dir ${_library_root_directory} ABSOLUTE)
12-
13- if (EXISTS ${absolute_lib_root_dir}/library.properties)
14- set(lib_props_file ${absolute_lib_root_dir}/library.properties)
15- else () # Properties file can't be found
16-
17- # Warn user and assume library is arch-agnostic
18- get_filename_component(library_name ${absolute_lib_root_dir} NAME)
19- message(WARNING "\"${library_name}\" library's properties file can't be found "
20- "under its' root directory - Assuming the library "
21- "is architecture-agnostic (supports all architectures)")
22- set(lib_props_file "")
23-
24- endif ()
25-
26- set(${_return_var} ${lib_props_file} PARENT_SCOPE)
27-
28- endfunction()
29-
301#=============================================================================#
312# Filters sources that relate to an architecture from the given list of unsupported architectures.
323# _unsupported_archs_regex - List of unsupported architectures as a regex-pattern string.
@@ -52,26 +23,27 @@ endfunction()
5223# 2. Filtering out any library sources that relate to unsupported architectures, i.e
5324# architectures other than the platform's.
5425# If the platform's architecture isn't supported by the library, CMake generates an error and stops.
55- # _library_root_dir - Path to library's root directory. Can be relative.
5626# _library_sources - List of library's sources to check and potentially filter.
27+ # [LIB_PROPS_FILE] - Full path to the library's properties file. Optional.
5728# _return_var - Name of variable in parent-scope holding the return value.
5829# Returns - Filtered list of sources containing only those that don't relate to
5930# any unsupported architecture.
6031#=============================================================================#
61- function(resolve_library_architecture _library_root_dir _library_sources _return_var)
32+ function(resolve_library_architecture _library_sources _return_var)
6233
6334 cmake_parse_arguments(parsed_args "" "LIB_PROPS_FILE" "" ${ARGN})
6435
6536 if (parsed_args_LIB_PROPS_FILE) # Library properties file is given
6637 set(lib_props_file ${parsed_args_LIB_PROPS_FILE})
6738 else ()
68- # Try to automatically find file from sources
69- _get_library_properties_file(${_library_root_dir} lib_props_file)
7039
71- if ("${lib_props_file}" STREQUAL "") # Properties file couldn't be found
72- set(${_return_var} "${_library_sources}" PARENT_SCOPE)
73- return()
74- endif ()
40+ # Warn user and assume library is arch-agnostic
41+ message(STATUS "Library's properties file can't be found "
42+ "under its' root directory - Assuming the library "
43+ "is architecture-agnostic (supports all architectures)")
44+ set(${_return_var} "${_library_sources}" PARENT_SCOPE)
45+ return()
46+
7547 endif ()
7648
7749 get_arduino_library_supported_architectures("${lib_props_file}" lib_archs)
0 commit comments