@@ -69,12 +69,6 @@ function(_get_unsupported_architectures _arch_list _return_var)
6969
7070endfunction ()
7171
72- function (add_arduino_header_only_library _target_name _board_id)
73-
74- _add_arduino_cmake_library(${_target_name} ${_board_id} "${_sources} " INTERFACE "${ARGN} " )
75-
76- endfunction ()
77-
7872#=============================================================================#
7973# Creates a library target for the given name and sources.
8074# As it's an Arduino library, it also finds and links all dependent platform libraries (if any).
@@ -92,6 +86,15 @@ function(add_arduino_library _target_name _board_id _sources)
9286
9387endfunction ()
9488
89+ function (add_arduino_header_only_library _target_name _board_id)
90+
91+ cmake_parse_arguments (parsed_args "ARCH" "" "HEADERS" ${ARGN} )
92+
93+ _add_arduino_cmake_library(${_target_name} ${_board_id} "${parsed_args_HEADERS} "
94+ INTERFACE ${parsed_args_ARCH} )
95+
96+ endfunction ()
97+
9598#=============================================================================#
9699# Finds an Arduino library with the given library name and creates a library target from it
97100# with the given target name.
@@ -139,8 +142,9 @@ function(find_arduino_library _target_name _library_name _board_id)
139142 message (SEND_ERROR "${error_message} " )
140143 else ()
141144 if (parsed_args_HEADER_ONLY)
142- add_arduino_header_only_library(${_target_name} ${_board_id} "${library_headers} "
143- INTERFACE ARCH ${lib_arch} )
145+ add_arduino_header_only_library(${_target_name} ${_board_id}
146+ ARCH ${lib_arch}
147+ HEADERS ${library_headers} )
144148 else ()
145149 find_library_source_files("${library_path} " library_sources)
146150 if (NOT library_sources)
@@ -151,7 +155,8 @@ function(find_arduino_library _target_name _library_name _board_id)
151155 message (SEND_ERROR "${error_message} " )
152156 else ()
153157 set (sources ${library_headers} ${library_sources} )
154- add_arduino_library(${_target_name} ${_board_id} "${sources} " ARCH ${lib_arch} )
158+ add_arduino_library(${_target_name} ${_board_id} "${sources} "
159+ ARCH ${lib_arch} )
155160 endif ()
156161 endif ()
157162 endif ()
0 commit comments