diff options
Diffstat (limited to 'examples/sdl2_audio/CMakeLists.txt')
-rw-r--r-- | examples/sdl2_audio/CMakeLists.txt | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/examples/sdl2_audio/CMakeLists.txt b/examples/sdl2_audio/CMakeLists.txt index 0732c10..d02631f 100644 --- a/examples/sdl2_audio/CMakeLists.txt +++ b/examples/sdl2_audio/CMakeLists.txt @@ -1,9 +1,24 @@ +if(POLICY CMP0111) + cmake_policy(SET CMP0111 NEW) +endif() + find_package(SDL2 REQUIRED) -string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES) +add_library(ADLMIDI_SDL2 INTERFACE) +if(TARGET SDL2::SDL2) + if(MINGW) + target_link_libraries(ADLMIDI_SDL2 INTERFACE mingw32 SDL2::SDL2main SDL2::SDL2) + else() + target_link_libraries(ADLMIDI_SDL2 INTERFACE SDL2::SDL2) + endif() + target_include_directories(ADLMIDI_SDL2 INTERFACE ${SDL2_INCLUDE_DIRS}) +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() add_executable(adlmidi_sdl2_demo sdl2_sample.c) -target_include_directories(adlmidi_sdl2_demo PRIVATE ${SDL2_INCLUDE_DIRS}) -target_link_libraries(adlmidi_sdl2_demo PRIVATE ADLMIDI ${SDL2_LIBRARIES}) +target_link_libraries(adlmidi_sdl2_demo PRIVATE ADLMIDI ADLMIDI_SDL2) set_nopie(adlmidi_sdl2_demo) |