-
Notifications
You must be signed in to change notification settings - Fork 808
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 basic support for cmake #857
base: master
Are you sure you want to change the base?
Conversation
Tests passed ✓, Code: 16666 B (+0.0%), Stack: 1432 B (+0.0%), Structs: 788 B (+0.0%)
|
Hi @MrJake222, thanks for creating a PR. I appreciate the thought to upstream this, but I'm hesitant to bring this in unless more people weigh in that this is useful. The problem is that there's always N+1 build systems, and my general experience is cmake configuration ends up very project-specific. Though those projects could have been using cmake "wrong". We would probably also need to add cmake to the CI to at least test that the configuration continues to build correctly. |
This would definately be usefull for us when integrtating littlefs into our CMake based projects. Having to add littlefs with ExternalProject_add() and setting a BUILD_COMMAND with a lot of parameters to get it into a CMake project is just not a good solution and is highly dependent of the format of the littlefs makefile. |
Adding CMake support would be really helpful for those using CMake for their projects. On the other hand:
I believe that it would be better just to create a section in the |
Yes.
👎 What if the app developer wants to include the littlefs repo as a git submodule, and build it as a library with CMake? |
@@ -0,0 +1,8 @@ | |||
add_library(littlefs) | |||
|
|||
target_sources(littlefs PUBLIC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't (or couldn't) this be PRIVATE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I tested it as PRIVATE
, and was able to build.
I'm a fan of CMake but would vote a no on this one. There is really only one compilation unit in the project. Two if you include the CRC implementation. Easy to add to any build system. Those that want to add it as a library, could do so. Those that want to add it directly into their own target, could do so as well. Pleasing both use cases and who knows what else invites some maintenance work along the way. Doing
|
It sounds like a problem with the build system if it doesn't support this use case.
CMake supports globbing doesn't it? The relevant sources are It's interesting to note no other project in the space (dhara, spiffs, ChaN's fatfs) provide a CMakeLists.txt. ChaN's fatfs, the most popular, doesn't even provide a Makefile. Worst case we could provide a separate repo, maybe littlefs-cmake, for CMake integration. But I think the CMakeLists.txt will never actually converge into something that makes everyone happy. I'm also not sure the maintainer-headache vs user-headache tradeoff makes sense... |
I'm not sure I'm entirely persuaded, but based on feedback here, I'm content not to keep advocating for this one. I'm not the pull requestor, though. |
A lot of projects (for ex. pico-sdk) use cmake as their compilation helper. I needed to include this in my Pico project, so here it is.
It becomes trivial to use (and also add compile flags). Example: