Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LIBS input property to GENERATE_ARDUINO_EXAMPLE #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ryanpfeeley
Copy link

This allows users to add static libraries to fix linking errors with generate_arduino_example that can sometimes occur.

Some arduino examples with multiple dependencies give linking errors (undefined references) when built with the generate_arduino_example command. For example,

generate_arduino_example(cardinfo-ex 
      LIBRARY SD
      EXAMPLE CardInfo
      BOARD pro) 

Will fail to properly link with the SPI library. There is possibly a way to fix this under-the-hood with improved dependency discovery. I don't know where to start with this. As work-around that is perfectly consistent with the other arduino-cmake function, this change adds the LIBS input argument to generate_arduino_example. This works like the existing LIBS inputs on generate_arduino_firmware and generate_arduino_library

The user can now use generate_arduino_library to create a static library for SPI, and then build the example with

generate_arduino_example(cardinfo-ex 
      LIBRARY SD
      EXAMPLE CardInfo
      LIBS SPI #SPI target created with generate_arduino_library
      BOARD pro) 

The cmake source code for the generate_arduino_example already handled
this input since it contains list(APPEND ALL_LIBS ${CORE_LIB} ${INPUT_LIBS}), so no changes were necessary for the function itself.

Hopefully this is helpful.

Some arduino examples with multiple dependencies give
linking errors when build with the generate_arduino_example command

This change add the LIBS input property. This works like the existing
LIBS inputs on generate_arduino_firmware and generate_arduino_library

The cmake source code for the generate_arduino_example already handled
this input, so no changes were necessary for the function itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant