diff --git a/CMakeLists.txt b/CMakeLists.txt index 659503eda..b09867bb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,7 +215,10 @@ else() elseif(TARGET SDL2::SDL2-static) # On some distros, such as vitasdk, only the SDL2::SDL2-static target is available. # Alias to SDL2::SDL2 because some finder scripts may refer to SDL2::SDL2. - set_target_properties(SDL2::SDL2-static PROPERTIES IMPORTED_GLOBAL TRUE) + if(CMAKE_VERSION VERSION_LESS "3.18") + # Aliasing local targets is not supported on CMake < 3.18, so make it global. + set_target_properties(SDL2::SDL2-static PROPERTIES IMPORTED_GLOBAL TRUE) + endif() add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) set(SDL2_MAIN SDL2::SDL2main) else()