From d0d0719e2d0fe88bbe80c93009f71d7a85eddd20 Mon Sep 17 00:00:00 2001 From: Epifanov Ivan Date: Tue, 27 Apr 2021 19:09:19 +0300 Subject: [PATCH] Apply target visibility on cmake < 3.18 only (#1729) Co-authored-by: Gleb Mazovetskiy --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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()