-
Notifications
You must be signed in to change notification settings - Fork 82
Examples
This page contains repositories that are either example outputs of cmake-init itself, or examples of other functionality implemented for CMake projects.
If you have ideas for examples, please do let me know in the Discussions forum of this project.
These repositories are outputs of cmake-init as of version 0.40.9:
- https://github.com/friendlyanon/cmake-init-executable
- https://github.com/friendlyanon/cmake-init-header-only
- https://github.com/friendlyanon/cmake-init-shared-static
There are also example repositories showing how to integrate with package managers:
- https://github.com/friendlyanon/cmake-init-vcpkg-example
- https://github.com/friendlyanon/cmake-init-conan-example
Here is an additional example written in C that makes use of fuzz testing and a superbuild to connect the fuzz project with the library project:
This example shows how to handle installing internal dependencies when the public targets are static libraries:
This example shows how to create multiple packages via CPack from a single project:
This example shows how to create a library that has a dependency that does not support clients who use CMake:
-
https://github.com/friendlyanon/cmake-init-use-pkg-config
Although this example focuses on a dependency that provides a.pc
file, that is only a minor detail and things would be largely the same regardless.
This example shows how to propagate transitive dependencies:
This example shows how to do code generation using a tool that is checked into version control as a separate project:
This project shows how to use CTest scripts to run your CI:
This example shows how to use the above CMake module to create opaque structs:
This examples shows how to vendor dependencies transparently using
FetchContent
and find modules, without compromising idiomatic find_package
usage:
-
https://github.com/friendlyanon/cmake-init-fetchcontent
This could be useful in situations where the developer does not wish to create a vcpkg overlay port to consume a dependency, because there is quick iteration in both the dependency and the dependee.
This is a relatively uninteresting SFML 2.5 "Hello world" example:
This example shows off using an in-source build tool, cross compiling and code generation: