You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Use INTERFACE_LINK_OPTIONS in sdl2_vendor
The SDL2_LIBRARIES value populated by sdl2-config.cmake doesn't actually
contain the path to the SDL2 library, but rather the linker options
necessary to link against SDL2. On Ubuntu, this appears to be `-lSDL2`.
On RHEL, this is `-L/usr/lib64 -lSDL2`.
The OBJECT_LOCATION property creates a Makefile target that the imported
library depends on. On Ubuntu, this utilizes a little-known feature of
GNU make where a target that starts with `-l` triggers a search on the
VPATH for a library to satisfy the target.
There are two problems here:
1. When SDL2_LIBRARIES contains more than just the `-lSDL2` linker
option, the aforementioned VPATH search doesn't work correctly.
2. The VPATH search may not be able to find libSDL2.so if it isn't in a
standard location, and the current approach doesn't make any effort
to modify the VPATH in the presence of a `-L` option.
I'm not sure if the `-l` behavior was known when this change was
implemented, or if we just got lucky that this worked out on Ubuntu.
In any case, switching to INTERFACE_LINK_OPTIONS is a more appropriate
way to use the stuff in the SDL2_LIBRARIES value. Unfortunately, a
SHARED target requires a backing object, so I had to switch it to an
INTERFACE target to make this work. I'm not entirely sure what secondary
effects that might have, but it appears to work in all cases that I
tested.
Signed-off-by: Scott K Logan <[email protected]>
0 commit comments