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

[CMake] Don't pull massive 3rd party dependencies via CMAKE by default #213

Open
Robert-M-Muench opened this issue Jan 19, 2025 · 4 comments

Comments

@Robert-M-Muench
Copy link

See: https://discord.com/channels/1291501630973415474/1328824444009054291/1330582239721029735

CLAY is announced as non-dependency lib, but pulls a ton of 3rd party dependencies via CMAKE, which pollutes/conflicts other projects using CLAY.

Make all those dependencies, like SDL3, optional or guard them.

@Robert-M-Muench
Copy link
Author

The main culprit on my side was that I used SDL3 as the CMAKE target name, and CLAY uses SDL.

It would make sense to list the target names in the build section. And maybe be more specific if it's SDL3 or SDL2.

@nicbarker
Copy link
Owner

Hello, thanks for opening this issue 👋
Could you give me a little more detail on what you're trying to achieve here?
Clay doesn't have a "build" per se, given that the library itself is a single file with no dependencies.
The CMakeLists.txt in the base of the repo is just for building the examples, but in your own project I think it just makes sense to pull in clay.h and not much else 🙂

@Robert-M-Muench
Copy link
Author

Yes, I understand.

The thing is when you are working on a bigger project using CMAKE. What you usually do is something like this:

FetchContent_Declare(
        clay
        GIT_REPOSITORY https://github.com/nicbarker/clay.git
        GIT_TAG main
)
FetchContent_MakeAvailable(clay)

This makes it super simple to have CLAY available, the IDE finding all necessary files, etc.

In bigger projects it's more convenient to use CMAKE for all the dependencies that adding a single .h file manually. Further, it simplifies using specific release-/tag-versions.

Even CLAY being a single-header-only thing, I think it makes sense to provide a CMAKE compatible way of including it via FetchContent_Declare.

@pope
Copy link

pope commented Jan 21, 2025

Is the answer to create an OPTION that only builds examples if the option is set to true?

option(CLAY_BUILD_EXAMPLES "Build example programs" OFF)

# ...

if(CLAY_BUILD_EXAMPLES)
  add_subdirectory("examples/cpp-project-example")
  # ...
endif()

EDIT: Oops. I see this is what #216 does.

@nicbarker nicbarker changed the title Don't pull massive 3rd party dependencies via CMAKE by default [CMake] Don't pull massive 3rd party dependencies via CMAKE by default Jan 21, 2025
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

3 participants