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

Adds basic support for cmake. #64

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

Conversation

atuleu
Copy link

@atuleu atuleu commented Dec 16, 2024

Knowning exactly what to do to use can2040 in a project can be a bit hairy.

This provide a CMakeLists file that is compatible with the pico C/C++ sdk to build the library. It is compatible with FetchContent.

Therefore including can2040 in a project can be done with

pico_sdk_init()

FetchContent_Declare(can2040
GIT_REPOSITORY https://github.com/KevinOConnor/can2040.git
GIT_TAG master)
FetchContent_MakeAvailable(can2040)
add_executable(myprog)
target_link_libraries(myprog can2040::can2040)

@KevinOConnor
Copy link
Owner

Thanks for working on this. In general, I agree it would be useful to have a build example in the can2040 repo. I have a few comments though:

  1. I'd prefer to have a single directory containing all the files needed for the example (eg, example/) and not have any files other than that in the root of the repo (that is, no .gitignore changes, no cmake files).
  2. I have not documented this, but I think it would be worthwhile to follow the Linux kernel style developer certificate of origin and have "signed-off-by" lines in every commit ( https://www.kernel.org/doc/html/latest/process/submitting-patches.html?highlight=signed%20off#sign-your-work-the-developer-s-certificate-of-origin ). I can update the documentation to reflect this requirement. It would mean contributions to can2040 would require agreeing to the developer certificate of origin and providing a full real name.
  3. The example code should have consistent indentation.

Cheers,
-Kevin

This commit provides:
 * support for CMake's `FetchContent` mechanism in `./cmake`
 * An example on how to use the library with the `pico-sdk` 2.1.0 in
 `./examples`

Signed-off-by: Alexandre Tuleu <[email protected]>
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.

2 participants