1 min read

How to disable screenshots & GIF recordings in raylib

Disabling a couple of Raylib features in CMake sounds simple. Until it isn’t. What begins as two harmless flags to turn off the built-in screenshot and GIF recording shortcuts quickly turns into a small adventure through CMake options and hidden build logic.

I’m trying to disable two small things in Raylib: the screenshot shortcut (F12) and the GIF recording shortcut (CTRL+F12). I don’t need them, and I don’t want end users to trigger them accidentally and get confused.

My project pulls Raylib in through CMake’s FetchContent:

I assume I can just turn off the features with two flags:

I rebuild, run the program, press F12 and it still takes a screenshot.

  • I delete the build folder and try again. Still there.
  • I assume FetchContent isn’t propagating the options correctly, so I clone Raylib directly and build it from source. Still doesn’t work.
  • I try making a static library and linking it manually. Same result.

At this point, I’m knee-deep in CMake files, flipping random flags like a madman. Eventually, I stumble across something called CUSTOMIZE_BUILD buried in Raylib’s build scripts and that’s when it clicks.

Raylib’s configuration system hides all its internal feature flags behind that one variable. Unless CUSTOMIZE_BUILD is enabled, any attempt to set SUPPORT_SCREEN_CAPTURE or SUPPORT_GIF_RECORDING is silently ignored.

The fix ends up being disappointingly simple:

I rebuild, run it again, and finally: F12 does nothing.

It’s the kind of thing that’s easy to miss, and I can’t seem to find anything about it online. So if you ever wonder why your Raylib flags don’t work, now you know.