Skip to content

Commit

Permalink
Silence complaints from FindSDL2 cmake module
Browse files Browse the repository at this point in the history
  • Loading branch information
katajakasa committed Aug 1, 2022
1 parent ffce647 commit 1c7921e
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions cmake/FindSDL2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit 1c7921e

Please sign in to comment.