Check result of FindLibraryAndSONAME before use
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index fd98ffb..b812f6a 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -111,8 +111,8 @@ macro(CheckALSA)
if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
endif()
- if(SDL_ALSA_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("asound")
+ FindLibraryAndSONAME("asound")
+ if(SDL_ALSA_SHARED AND ASOUND_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
set(HAVE_ALSA_SHARED TRUE)
else()
@@ -140,8 +140,8 @@ macro(CheckPipewire)
if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading")
endif()
- if(SDL_PIPEWIRE_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("pipewire-0.3")
+ FindLibraryAndSONAME("pipewire-0.3")
+ if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
set(HAVE_PIPEWIRE_SHARED TRUE)
else()
@@ -169,8 +169,8 @@ macro(CheckPulseAudio)
if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
endif()
- if(SDL_PULSEAUDIO_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("pulse-simple")
+ FindLibraryAndSONAME("pulse-simple")
+ if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"")
set(HAVE_PULSEAUDIO_SHARED TRUE)
else()
@@ -198,8 +198,8 @@ macro(CheckJACK)
if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading")
endif()
- if(SDL_JACK_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("jack")
+ FindLibraryAndSONAME("jack")
+ if(SDL_JACK_SHARED AND JACK_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"")
set(HAVE_JACK_SHARED TRUE)
else()
@@ -227,8 +227,8 @@ macro(CheckESD)
if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic ESD loading")
endif()
- if(SDL_ESD_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME(esd)
+ FindLibraryAndSONAME(esd)
+ if(SDL_ESD_SHARED AND ESD_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"")
set(HAVE_ESD_SHARED TRUE)
else()
@@ -260,9 +260,9 @@ macro(CheckARTS)
if(SDL_ARTS_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading")
endif()
- if(SDL_ARTS_SHARED AND HAVE_SDL_LOADSO)
+ FindLibraryAndSONAME(artsc)
+ if(SDL_ARTS_SHARED AND ARTSC_LIB AND HAVE_SDL_LOADSO)
# TODO
- FindLibraryAndSONAME(artsc)
set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"")
set(HAVE_ARTS_SHARED TRUE)
else()
@@ -291,8 +291,8 @@ macro(CheckNAS)
if(SDL_NAS_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic NAS loading")
endif()
- if(SDL_NAS_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("audio")
+ FindLibraryAndSONAME("audio")
+ if(SDL_NAS_SHARED AND AUDIO_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"")
set(HAVE_NAS_SHARED TRUE)
else()
@@ -321,8 +321,8 @@ macro(CheckSNDIO)
if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
endif()
- if(SDL_SNDIO_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("sndio")
+ FindLibraryAndSONAME("sndio")
+ if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
set(HAVE_SNDIO_SHARED TRUE)
else()
@@ -350,8 +350,8 @@ macro(CheckFusionSound)
if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading")
endif()
- if(FUSIONSOUND_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("fusionsound")
+ FindLibraryAndSONAME("fusionsound")
+ if(FUSIONSOUND_SHARED AND FUSIONSOUND_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"")
set(HAVE_FUSIONSOUND_SHARED TRUE)
else()
@@ -375,8 +375,8 @@ macro(CheckLibSampleRate)
if(SDL_LIBSAMPLERATE_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading")
endif()
- if(SDL_LIBSAMPLERATE_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("samplerate")
+ FindLibraryAndSONAME("samplerate")
+ if(SDL_LIBSAMPLERATE_SHARED AND SAMPLERATE_LIB AND HAVE_SDL_LOADSO)
set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"")
set(HAVE_LIBSAMPLERATE_SHARED TRUE)
else()
@@ -459,7 +459,7 @@ macro(CheckX11)
else()
set(HAVE_X11_SHARED TRUE)
endif()
- if(HAVE_X11_SHARED)
+ if(HAVE_X11_SHARED AND X11_LIB AND XEXT_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"")
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"")
else()
@@ -662,11 +662,11 @@ macro(CheckWayland)
if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading")
endif()
- if(SDL_WAYLAND_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME(wayland-client)
- FindLibraryAndSONAME(wayland-egl)
- FindLibraryAndSONAME(wayland-cursor)
- FindLibraryAndSONAME(xkbcommon)
+ FindLibraryAndSONAME(wayland-client)
+ FindLibraryAndSONAME(wayland-egl)
+ FindLibraryAndSONAME(wayland-cursor)
+ FindLibraryAndSONAME(xkbcommon)
+ if(SDL_WAYLAND_SHARED AND WAYLAND_CLIENT_LIB AND WAYLAND_EGL_LIB AND WAYLAND_CURSOR_LIB AND XKBCOMMON_LIB AND HAVE_SDL_LOADSO)
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"")
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"")
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "\"${WAYLAND_CURSOR_LIB_SONAME}\"")
@@ -686,9 +686,9 @@ macro(CheckWayland)
if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading")
endif()
- if(SDL_WAYLAND_LIBDECOR_SHARED AND HAVE_SDL_LOADSO)
+ FindLibraryAndSONAME(decor-0)
+ if(SDL_WAYLAND_LIBDECOR_SHARED AND DECOR_0_LIB AND HAVE_SDL_LOADSO)
set(HAVE_LIBDECOR_SHARED TRUE)
- FindLibraryAndSONAME(decor-0)
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"")
else()
list(APPEND EXTRA_LIBS ${LIBDECOR_LIBRARIES})
@@ -736,8 +736,8 @@ macro(CheckDirectFB)
if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
endif()
- if(SDL_DIRECTFB_SHARED AND HAVE_SDL_LOADSO)
- FindLibraryAndSONAME("directfb")
+ FindLibraryAndSONAME("directfb")
+ if(SDL_DIRECTFB_SHARED AND DIRECTFB_LIB AND HAVE_SDL_LOADSO)
set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"")
set(HAVE_DIRECTFB_SHARED TRUE)
else()
@@ -1155,7 +1155,9 @@ macro(CheckHIDAPI)
else()
# libusb is loaded dynamically, so don't add it to EXTRA_LIBS
FindLibraryAndSONAME("usb-1.0")
- set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"")
+ if(USB_1.0_LIB)
+ set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"")
+ endif()
endif()
endif()
endif()