From 1c7921eb62fb1b2e14df948d396c88203e7a9116 Mon Sep 17 00:00:00 2001 From: Tuomas Virtanen Date: Tue, 2 Aug 2022 00:14:27 +0300 Subject: [PATCH] Silence complaints from FindSDL2 cmake module Added https://github.com/aminosbh/sdl2-cmake-modules/pull/6 --- cmake/FindSDL2.cmake | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake index a3673a7..00a860d 100644 --- a/cmake/FindSDL2.cmake +++ b/cmake/FindSDL2.cmake @@ -42,13 +42,15 @@ This module defines the following 'IMPORTED' targets: :: - SDL2::Core + SDL2::Core (for compatibility with older versions) + SDL2::SDL2 (compatibility with CONFIG mode) The SDL2 library, if found. - Libraries should link to SDL2::Core + Libraries should link to SDL2::SDL2 - SDL2::Main + SDL2::Main (for compatibility with older versions) + SDL2::SDL2main (compatibility with CONFIG mode) The SDL2main library, if found. - Applications should link to SDL2::Main instead of SDL2::Core + Applications should link to SDL2::SDL2main instead of SDL2::SDL2 @@ -310,16 +312,14 @@ endif() include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 - REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR - VERSION_VAR SDL2_VERSION_STRING) - +set(SDL2_REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) if(SDL2MAIN_LIBRARY) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2main - REQUIRED_VARS SDL2MAIN_LIBRARY SDL2_INCLUDE_DIR - VERSION_VAR SDL2_VERSION_STRING) + list(APPEND SDL2_REQUIRED_VARS SDL2MAIN_LIBRARY SDL2_INCLUDE_DIR) endif() +find_package_handle_standard_args(SDL2 + REQUIRED_VARS ${SDL2_REQUIRED_VARS} + VERSION_VAR SDL2_VERSION_STRING) mark_as_advanced(SDL2_PATH SDL2_NO_DEFAULT_PATH @@ -384,5 +384,9 @@ if(SDL2_FOUND) INTERFACE_LINK_LIBRARIES SDL2::MainInternal) endif() + # compatibility targets + add_library(SDL2::SDL2 ALIAS SDL2::Core) + add_library(SDL2::SDL2main ALIAS SDL2::Main) + endif() endif()