SDL
SDL copied to clipboard
/usr/local/include not included for X11 headers on FreeBSD when linking with CMake
This seems to be a slightly different version of #2915, except instead of being an issue with building SDL, it's an issue with building software that uses SDL.
SDL_syswm.h
includes X11 headers, even though they may not be available in the default include paths. In particular, FreeBSD keeps its X11 headers in /usr/local/include
, which is not searched by default (at least by Clang). Linking SDL with CMake doesn't result in /usr/local/include
being added as an include path, resulting in build errors.
Downstream projects could include /usr/local/include
to work around this, but I feel that would be a workaround for an upstream problem.
This issue was encountered with SDL 2.0.22.
Related, here is an OpenBSD patch to address this: http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/devel/sdl2/patches/patch-sdl2-config_in?rev=1.3&content-type=text/plain&hideattic=1
Related, here is an OpenBSD patch to address this: http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/devel/sdl2/patches/patch-sdl2-config_in?rev=1.3&content-type=text/plain&hideattic=1
For OpenBSD, that is why we have @X_CFLAGS@
for /usr/X11R6/include
. But the root @includedir@
was added for /usr/local/include for other of the required dependencies.
https://github.com/libsdl-org/SDL/pull/6084 should fix this, but I'm unsure whether this is a good approach.
#7923 should fix this for SDL3. SDL2 will keep the status quo. Can anybody with FreeBSD test this pr?