aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2019-01-24 09:28:17 +0100
committerJP Cimalando <jpcima@users.noreply.github.com>2019-01-24 10:59:51 +0100
commitaf786beba6e195dea9ca02ae47315945c8f9b1c8 (patch)
tree8bdc0b08ae79a816c3885b1f4309fa7bda995eba /CMakeLists.txt
parent25c48a996ae22d226a4469340c01b1724b398fae (diff)
downloadlibADLMIDI-af786beba6e195dea9ca02ae47315945c8f9b1c8.tar.gz
libADLMIDI-af786beba6e195dea9ca02ae47315945c8f9b1c8.tar.bz2
libADLMIDI-af786beba6e195dea9ca02ae47315945c8f9b1c8.zip
fix the SDL2 library search
This allows to handle two variants of SDL2 find modules, which are incompatible: - the first kind of module sets the SDL2_* variables - the other kind exports the library target SDL2::SDL2
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4355b75..7cffbda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -233,6 +233,20 @@ else()
add_library(ADLMIDI ALIAS ADLMIDI_static)
endif()
+function(libADLMIDI_find_SDL2)
+ if(NOT TARGET ADLMIDI_SDL2)
+ find_package(SDL2 REQUIRED)
+ add_library(ADLMIDI_SDL2 INTERFACE)
+ if(TARGET SDL2::SDL2)
+ target_link_libraries(ADLMIDI_SDL2 INTERFACE SDL2::SDL2)
+ else()
+ string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
+ target_include_directories(ADLMIDI_SDL2 INTERFACE ${SDL2_INCLUDE_DIRS})
+ target_link_libraries(ADLMIDI_SDL2 INTERFACE ${SDL2_LIBRARIES})
+ endif()
+ endif()
+endfunction()
+
if(WITH_OLD_UTILS)
# Old utility to dump AdLib bank files
add_subdirectory(utils/dumpbank)