Skip to content

A convenience wrapper around the popular stb libraries

License

Notifications You must be signed in to change notification settings

Jelegk/stb-cmake-wrapper

 
 

Repository files navigation

stb cmake wrapper

The popular stb libraries are a set of header-only libraries which are very easy to just copy and paste into existing codebases. However, if you have already set up a cmake based project is sometimes convenient to have proper cmake targets for the individual libraries. This wrapper creates cmake targets for each library that takes care of adding the actual implementation for the libraries, i.e., adding the proper STB_(...)_IMPLEMENTATION define.

Fork

This is a fork of a fork to update the version of stb, fix some minor documentation issues, and update the cmake min target in the era of CMake 4.0 deprecating older versions.
edit: and bypass a compile error
edit2: and add cmake exporting capabilities.

Consuming this library in cmake

After adding this wrapper to your project you have access to the stb::LIBRARY_NAME targets. For example, to use the image library you simply add this to your cmake script:

target_link_libraries(YOUR_TARGET PUBLIC stb::image)

Adding the wrapper to your project

  1. Via CPM: simply add CPMAddPackage("gh:Jelegk/stb-cmake-wrapper@0.3") to your cmake script.
  2. Via git submodules: add a submodule to your repository and add add_subdirectory(path/to/stb-cmake-wrapper).
  3. Alternatively you can also copy and paste the contents of this repository.

Library support

This list gives an overview of the currently supported libraries. The libraries currently not supported by the wrapper are the ones needing additional defines to work (textedit, voxel_render, tilemap_editor, connected_components).

License

MIT

About

A convenience wrapper around the popular stb libraries

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CMake 87.8%
  • C 12.2%