-
Notifications
You must be signed in to change notification settings - Fork 38
Unsupported header-only libraries when using 'find' API #31
Comments
@machadolab I'm completely stuck on this one. The biggest problem is that the header file not only declares functions (such as I have absolutely no idea how to solve this, nor how does the Arduino IDE manages to build it successfully. |
Not sure either. I would say just don’t support that mode and encourage people using this project to report to the lib maintainer to properly format their source when it comes up. I doubt many new libs following the 1.5 spec would have this problem. |
It doesn't really matter if the library conform to the 1.0 standard or the 1.5, since the standard doesn't mention anything about this "style" of source/header files. Nevertheless, I might've thought about a possible solution, and I think this is probably how the Arduino IDE does it, but it's extremely complicated and would be pretty hard to implement in CMake. |
@machadolab BTW, could you find me a good Arduino header-only library to test against? |
Currently there's no support for header-only libraries, especially when using the
find_library
API.The reason for this is that the
find_library
fails if it doesn't finds any source files, however, that's always the case for header-only libraries, and can be marked as "false-positive".Solution would be simply to pass an option to the function - HEADER_ONLY, which will hint the framework to ignore sources.
Edit: CMake can't compile nor link header-only libraries, and must use the
INTERFACE
keyword instead. This leads to a far more complicated solution, which will probably require a separate function.The text was updated successfully, but these errors were encountered: