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

Add CMake interface library target #183

Merged
merged 3 commits into from
Mar 26, 2021
Merged

Add CMake interface library target #183

merged 3 commits into from
Mar 26, 2021

Conversation

legends2k
Copy link
Contributor

Projects using cglm as a header-only library needn’t build files under
src/. Provide a target which allows them to skip compiling them by

add_subdirectory(external/cglm EXCLUDE_FROM_ALL)
target_link_libraries(MyExe PRIVATE cglm_headers)

Projects using cglm as a header-only library needn’t build files under
src/. Provide a target which allows them to skip compiling them by

add_subdirectory(external/cglm EXCLUDE_FROM_ALL)
target_link_libraries(MyExe PRIVATE cglm_headers)
@legends2k
Copy link
Contributor Author

legends2k commented Mar 25, 2021

This is my first PR here, so I might be completely off, please educate me if I'm missing something; I'm happy to take comments. I've gone through CONTRIBUTING.md too. Thanks!

Bug #181 would be resolved with this issue.

@recp
Copy link
Owner

recp commented Mar 25, 2021

Hi @legends2k

Thanks for creating a PR for that issue 🤗

add_subdirectory(external/cglm EXCLUDE_FROM_ALL)
target_link_libraries(MyExe PRIVATE cglm_headers)

We should include this guide to README and docs (docs/source/build.rst) which will help to users to be aware of this feature.

Do we need to add all headers manually in add_target INTERFACE?

Resources for header-only library (but we provide both compiled and header only or header-only):
[0] http://mariobadr.com/creating-a-header-only-library-with-cmake.html
[1] https://hsf-training.github.io/hsf-training-cmake-webpage/04-targets/index.html

@legends2k
Copy link
Contributor Author

legends2k commented Mar 26, 2021

@recp You're right, I've removed the header listing as it's needless. Thanks for reviewing the change.

Found a related post: Opt-in header-only libraries with CMake; example is equivalent to cglm: shared, static and header-only.

@recp recp merged commit 8f09cc8 into recp:master Mar 26, 2021
@recp
Copy link
Owner

recp commented Mar 26, 2021

@legends2k the PR is merged, thanks for your contributions 🎉

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.

None yet

2 participants