Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Libraries API

Timor Gruber edited this page Dec 30, 2018 · 3 revisions

Add

Libraries can be manually added using the add_arduino_library function. It accepts the following parameters:

Order Name Description Required?
1st _target_name Library's target name as it will be registered by CMake. Yes
2nd _board_id Hardware Board's ID as retrieved by the get_board_id function. Yes
- _sources List of source files to include in the library target. No
Header-Only Add

Header-Only libraries can be manually added using the add_arduino_header_only_library function. It accepts the same parameters as the add_arduino_library function.

Find

Libraries can be found using the find_arduino_library function. It accepts the following parameters:

Order Name Description Required?
1st _target_name Library's target name as it will be registered by CMake. Yes
2nd _library_name Name of the library to search for. This is actually the name of the library's root directory. Name can be case-insensitive when searching Built-in Libraries, must be case-sensitive when searching 3rd Party libraries. Yes
3rd _board_id Hardware Board's ID as retrieved by the get_board_id function. Yes
- 3RD_PARTY Whether the searched library should be treated as a 3rd Party library No
- HEADER_ONLY Whether the searched library should be treated as a header-only library No
- QUIET Whether the function should fail silently in case of an error No

Link

Arduino Libraries

Libraries can be linked to a target using the link_arduino_library function. It accepts the following parameters:

Order Name Description Required?
1st _target_name Name of the target to link to, usually an executable created with add_arduino_executable Yes
2nd _library_target_name Name of a library target. If it's an Arduino Library, it's the name found earlier with find_arduino_library. Otherwise, it's the target created with CMake's add_library. Yes
3rd _board_id Hardware Board's ID as retrieved by the get_board_id function. Yes
- HEADER_ONLY Whether the linked library should be treated as a header-only library NO
Platform Libraries

Platform libraries such as SPI, Wire, etc. have a separate function for linking them to a target. This function is named link_platform_library and accepts the following parameters:

Libraries can be linked to a target using the link_arduino_library function. It accepts the following parameters:

Order Name Description Required?
1st _target_name Name of the target to link to, usually an executable created with add_arduino_executable Yes
2nd _platform_library_name Name of a platform library. Yes
3rd _board_id Hardware Board's ID as retrieved by the get_board_id function. Yes
- HEADER_ONLY Whether the linked library should be treated as a header-only library NO
Morty Proxy This is a proxified and sanitized view of the page, visit original site.