Update FindSDL_gfx.cmake as of today's upstream
Ongoing PR: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7475
This commit is contained in:
parent
c37cd892a0
commit
8f3403dffa
|
@ -3,7 +3,7 @@
|
|||
|
||||
#[=======================================================================[.rst:
|
||||
FindSDL_gfx
|
||||
-------------
|
||||
-----------
|
||||
|
||||
Locate SDL_gfx library
|
||||
|
||||
|
@ -11,36 +11,19 @@ This module defines:
|
|||
|
||||
::
|
||||
|
||||
SDL::SDL_gfx, the name of the target to use with target_*() commands
|
||||
SDL_GFX_LIBRARIES, the name of the library to link against
|
||||
SDL_GFX_INCLUDE_DIRS, where to find the headers
|
||||
SDL_GFX_FOUND, if false, do not try to link against
|
||||
SDL_GFX_VERSION_STRING - human-readable string containing the
|
||||
version of SDL_gfx
|
||||
|
||||
|
||||
|
||||
For backward compatibility the following variables are also set:
|
||||
|
||||
::
|
||||
|
||||
SDLGFX_LIBRARY (same value as SDL_GFX_LIBRARIES)
|
||||
SDLGFX_INCLUDE_DIR (same value as SDL_GFX_INCLUDE_DIRS)
|
||||
SDLGFX_FOUND (same value as SDL_GFX_FOUND)
|
||||
|
||||
|
||||
|
||||
$SDLDIR is an environment variable that would correspond to the
|
||||
./configure --prefix=$SDLDIR used in building SDL.
|
||||
|
||||
Created by Xavier Del Campo, heavily based on the original work by
|
||||
Eric Wing, FindSDL_mixer.cmake.
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT SDL_GFX_INCLUDE_DIR AND SDLGFX_INCLUDE_DIR)
|
||||
set(SDL_GFX_INCLUDE_DIR ${SDLGFX_INCLUDE_DIR} CACHE PATH "directory cache
|
||||
entry initialized from old variable name")
|
||||
endif()
|
||||
find_path(SDL_GFX_INCLUDE_DIR
|
||||
find_path(SDL_GFX_INCLUDE_DIRS
|
||||
NAMES
|
||||
SDL_framerate.h
|
||||
SDL_gfxBlitFunc.h
|
||||
SDL_gfxPrimitives.h
|
||||
|
@ -61,11 +44,7 @@ else()
|
|||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
if(NOT SDL_GFX_LIBRARY AND SDLGFX_LIBRARY)
|
||||
set(SDL_GFX_LIBRARY ${SDLGFX_LIBRARY} CACHE FILEPATH "file cache entry
|
||||
initialized from old variable name")
|
||||
endif()
|
||||
find_library(SDL_GFX_LIBRARY
|
||||
find_library(SDL_GFX_LIBRARIES
|
||||
NAMES SDL_gfx
|
||||
HINTS
|
||||
ENV SDLGFXDIR
|
||||
|
@ -73,10 +52,10 @@ find_library(SDL_GFX_LIBRARY
|
|||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
if(SDL_GFX_INCLUDE_DIR AND EXISTS "${SDL_GFX_INCLUDE_DIR}/SDL_gfxPrimitives.h")
|
||||
file(STRINGS "${SDL_GFX_INCLUDE_DIR}/SDL_gfxPrimitives.h" SDL_GFX_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_GFXPRIMITIVES_MAJOR[ \t]+[0-9]+$")
|
||||
file(STRINGS "${SDL_GFX_INCLUDE_DIR}/SDL_gfxPrimitives.h" SDL_GFX_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_GFXPRIMITIVES_MINOR[ \t]+[0-9]+$")
|
||||
file(STRINGS "${SDL_GFX_INCLUDE_DIR}/SDL_gfxPrimitives.h" SDL_GFX_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_GFXPRIMITIVES_MICRO[ \t]+[0-9]+$")
|
||||
if(SDL_GFX_INCLUDE_DIRS AND EXISTS "${SDL_GFX_INCLUDE_DIRS}/SDL_gfxPrimitives.h")
|
||||
file(STRINGS "${SDL_GFX_INCLUDE_DIRS}/SDL_gfxPrimitives.h" SDL_GFX_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_GFXPRIMITIVES_MAJOR[ \t]+[0-9]+$")
|
||||
file(STRINGS "${SDL_GFX_INCLUDE_DIRS}/SDL_gfxPrimitives.h" SDL_GFX_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_GFXPRIMITIVES_MINOR[ \t]+[0-9]+$")
|
||||
file(STRINGS "${SDL_GFX_INCLUDE_DIRS}/SDL_gfxPrimitives.h" SDL_GFX_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_GFXPRIMITIVES_MICRO[ \t]+[0-9]+$")
|
||||
string(REGEX REPLACE "^#define[ \t]+SDL_GFXPRIMITIVES_MAJOR[ \t]+([0-9]+)$" "\\1" SDL_GFX_VERSION_MAJOR "${SDL_GFX_VERSION_MAJOR_LINE}")
|
||||
string(REGEX REPLACE "^#define[ \t]+SDL_GFXPRIMITIVES_MINOR[ \t]+([0-9]+)$" "\\1" SDL_GFX_VERSION_MINOR "${SDL_GFX_VERSION_MINOR_LINE}")
|
||||
string(REGEX REPLACE "^#define[ \t]+SDL_GFXPRIMITIVES_MICRO[ \t]+([0-9]+)$" "\\1" SDL_GFX_VERSION_PATCH "${SDL_GFX_VERSION_PATCH_LINE}")
|
||||
|
@ -89,18 +68,17 @@ if(SDL_GFX_INCLUDE_DIR AND EXISTS "${SDL_GFX_INCLUDE_DIR}/SDL_gfxPrimitives.h")
|
|||
unset(SDL_GFX_VERSION_PATCH)
|
||||
endif()
|
||||
|
||||
set(SDL_GFX_LIBRARIES ${SDL_GFX_LIBRARY})
|
||||
set(SDL_GFX_INCLUDE_DIRS ${SDL_GFX_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_gfx
|
||||
REQUIRED_VARS SDL_GFX_LIBRARIES SDL_GFX_INCLUDE_DIRS
|
||||
VERSION_VAR SDL_GFX_VERSION_STRING)
|
||||
|
||||
# for backward compatibility
|
||||
set(SDLGFX_LIBRARY ${SDL_GFX_LIBRARIES})
|
||||
set(SDLGFX_INCLUDE_DIR ${SDL_GFX_INCLUDE_DIRS})
|
||||
set(SDLGFX_FOUND ${SDL_GFX_FOUND})
|
||||
|
||||
mark_as_advanced(SDL_GFX_LIBRARY SDL_GFX_INCLUDE_DIR)
|
||||
if(SDL_gfx_FOUND)
|
||||
if(NOT TARGET SDL::SDL_gfx)
|
||||
add_library(SDL::SDL_gfx INTERFACE IMPORTED)
|
||||
set_target_properties(SDL::SDL_gfx PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL_GFX_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${SDL_GFX_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue