|
3 | 3 | # As it's an Arduino library, it also finds and links all dependent platform libraries (if any). |
4 | 4 | # _target_name - Name of the library target to be created. Usually library's real name. |
5 | 5 | # _board_id - Board ID associated with the linked Core Lib. |
6 | | -# [LIB_PROPS_FILE] - Full path to the library's properties file. Optional. |
7 | 6 | # [Sources] - List of source files (Could also be headers for code-inspection in some IDEs) |
8 | 7 | # to create the executable from, similar to CMake's built-in add_executable. |
9 | 8 | #=============================================================================# |
10 | 9 | function(add_arduino_library _target_name _board_id) |
11 | 10 |
|
12 | | - cmake_parse_arguments(parsed_args "" "LIB_PROPS_FILE" "" ${ARGN}) |
13 | | - parse_sources_arguments(parsed_sources "" "LIB_PROPS_FILE" "" "${ARGN}") |
| 11 | + parse_sources_arguments(parsed_sources "" "" "" "${ARGN}") |
14 | 12 |
|
15 | | - if (parsed_args_LIB_PROPS_FILE) |
16 | | - resolve_library_architecture("${parsed_sources}" arch_resolved_sources |
17 | | - LIB_PROPS_FILE ${parsed_args_LIB_PROPS_FILE}) |
18 | | - else () |
19 | | - |
20 | | - get_sources_root_directory("${parsed_sources}" library_root_dir) |
| 13 | + get_sources_root_directory("${parsed_sources}" library_root_dir) |
21 | 14 |
|
22 | | - get_library_properties_file(${library_root_dir} library_properties_file) |
23 | | - |
24 | | - if (library_properties_file) # Properties file has been found |
25 | | - resolve_library_architecture("${parsed_sources}" arch_resolved_sources |
26 | | - LIB_PROPS_FILE ${library_properties_file}) |
27 | | - else () |
28 | | - resolve_library_architecture("${parsed_sources}" arch_resolved_sources) |
29 | | - endif () |
| 15 | + get_library_properties_file(${library_root_dir} library_properties_file) |
30 | 16 |
|
| 17 | + if (library_properties_file) # Properties file has been found |
| 18 | + resolve_library_architecture("${parsed_sources}" arch_resolved_sources |
| 19 | + LIB_PROPS_FILE ${library_properties_file}) |
| 20 | + else () |
| 21 | + resolve_library_architecture("${parsed_sources}" arch_resolved_sources) |
31 | 22 | endif () |
32 | 23 |
|
33 | 24 | _add_arduino_cmake_library(${_target_name} ${_board_id} "${arch_resolved_sources}") |
|
0 commit comments