SDL icon indicating copy to clipboard operation
SDL copied to clipboard

cmake: add option to override _any_ compile definition

Open madebr opened this issue 2 years ago • 2 comments

This pr adds a cmake option (-DSDL_DEFINE_OVERRIDES=...) that allows to override any define present in SDL_build_config.h. By e.g. configuring with -DSDL_DEFINE_OVERRIDES="SDL_JOYSTICK_MFI=0;SDL_VIDEO_DRIVER_X11_DYNAMIC=\"libX11.so.9\"", you can override these macros.

Important to know is that CMake will still run its detection routines. The defines are only overridden at the end, just before generating SDL_build_config.h. So this option cannot add sources to the build.

Because this option can override everything in cmake, it always emits a cmake warning. The option is aimed for developers, and for trying things out.

@slouken Is this what you have in mind?

Description

Existing Issue(s)

Fixes https://github.com/libsdl-org/SDL/issues/8534

madebr avatar Nov 12 '23 03:11 madebr

Is it possible to take the value from the command line directly? This will solve my use case, but so did editing the generated header after the configuration. I was thinking of something that would be more intuitive and in line with the other ways people modify the cmake build process.

slouken avatar Nov 13 '23 02:11 slouken

@madebr, did you see my question above?

slouken avatar Aug 06 '24 16:08 slouken