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

REGEX in find_arduino_libraries doesn't match #includes with trailing spaces or comments #163

Open
ryanpfeeley opened this issue Feb 15, 2016 · 0 comments

Comments

@ryanpfeeley
Copy link

The result of this bug is needed dependencies are not included, resulting in compile errors.

I've only verified this when using the generate_arduino_example( ) syntax, but I expect it applies to other cases.

In short, if the myExample.ino file has an #include directive for an Arduino library header file and the directive has trailing whitespace or a trailing comment, the REGEX used in:

if("#${SRC_LINE}#" MATCHES "^#[ \t]*#[ \t]*include[ \t]*[<\"]([^>\"]*)[>\"]#")

does not match it, so that library doesn't get added to the includes.

A simple fix is to replace the line with:

if("#${SRC_LINE}#" MATCHES "^#[ \t]*#[ \t]*include[ \t]*[<\"]([^>\"]*)[>\"].*#")

This simple fix of appending .* allows any trailing characters, so it doesn't enforce the language syntax, but that is fine. Arduino-cmake can take care of including the dependencies and the compiler can pick up syntax errors since users are accustomed to silly formatting errors that are caught by the compiler.

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

No branches or pull requests

1 participant