Skip to content

Add CMake static library target for stb_image - #2015

Closed
FadyDhaim wants to merge 1 commit into
nothings:masterfrom
FadyDhaim:cmake/stb-image-static-library
Closed

FadyDhaim wants to merge 1 commit into
nothings:masterfrom
FadyDhaim:cmake/stb-image-static-library

Conversation

@FadyDhaim

Copy link
Copy Markdown

Adds initial CMake support for stb_image as a static library.

  • Adds a dedicated stb_image directory with its implementation translation unit (rather than having the client implement what's already implemented).
  • Exposes stb_image.h through a public include directory.
  • Provides the stb::stb_image CMake target.
  • Leaves existing upstream headers and other stb libraries unchanged.

The target is intended to be consumed through FetchContent and target_link_libraries().

@nothings

Copy link
Copy Markdown
Owner

Absurd. No. Clients can do this if they want, the implementation is two lines, but it doesn't make sense to introduce a dependency on CMake for people who don't already use it, and moving the header file around just breaks things unnecessarily.

@nothings nothings closed this Oct 16, 2026
@FadyDhaim

Copy link
Copy Markdown
Author

you can just create a new branch specifically for cmake, your project structure is essentially unorganized, moving a header of a specific component to its corresponding sub-target folder is a cmake convention and is a necessity anyway since i can't target_include_directories your whole root folder while only introducing implementation for stb_image_h, exposing the rest of the headers is a jarring mistake.

@nothings

Copy link
Copy Markdown
Owner

Arguably, this IS the public include directory, it doesn't need a subdirectory that has that.

But really, this is not meant to be a build directory structure. It's a place in which I've put files that you copy into your project in an appropriate place.

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