Merge topic 'ImproveFindSDLxxxModules'

68c6b13 FindSDL: Stay compatible with old input variables
9ed24c5 FindSDL: Remove from find_... calls PATHS that are set by default
38a0f71 FindSDL: Add my copyright tag to all FindSDL_* modules
020d213 FindSDL: Add version support
61a566c FindSDL: Format documentation
22154c7 FindSDL: Update documentation
4541c07 FindSDL: Add version support for FindSDL_ttf
a28c247 FindSDL: Use SDL_TTF prefix for variables
9f5dbf4 FindSDL: Update documentation
d83f80d FindSDL: Add version support for FindSDL_mixer
c10b691 FindSDL: Use SDL_MIXER prefix for variables
03dd6cc FindSDL: Pass SDL_SOUND_LIBRARY to FIND_PACKAGE_HANDLE_STANDARD_ARGS
326beca FindSDL: Use same capitalization for FPHSA as file name
cfe5b87 FindSDL: Version support for FindSDL_sound
776d3fe FindSDL: Format the documentation
a5194e2 FindSDL: Add "cmake_minimum_required" to "try_compile" project
...
This commit is contained in:
David Cole 2012-09-25 15:18:05 -04:00 committed by CMake Topic Stage
commit 7d03885d21
6 changed files with 285 additions and 189 deletions

View File

@ -1,16 +1,17 @@
# Locate SDL library
# - Locate SDL library
# This module defines
# SDL_LIBRARY, the name of the library to link against
# SDL_FOUND, if false, do not try to link to SDL
# SDL_INCLUDE_DIR, where to find SDL.h
# SDL_LIBRARY, the name of the library to link against
# SDL_FOUND, if false, do not try to link to SDL
# SDL_INCLUDE_DIR, where to find SDL.h
# SDL_VERSION_STRING, human-readable string containing the version of SDL
#
# This module responds to the the flag:
# SDL_BUILDING_LIBRARY
# If this is defined, then no SDL_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL_LIBRARY variable.
# SDL_BUILDING_LIBRARY
# If this is defined, then no SDL_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL_LIBRARY variable.
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDLmain which
@ -54,6 +55,7 @@
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -68,18 +70,7 @@
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
PATH_SUFFIXES include/SDL include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL12
/usr/local/include/SDL11 # FreeBSD ports
/usr/include/SDL12
/usr/include/SDL11
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
PATH_SUFFIXES SDL SDL12 SDL11
)
# SDL-1.1 is the name used by FreeBSD ports...
@ -88,12 +79,6 @@ find_library(SDL_LIBRARY_TEMP
NAMES SDL SDL-1.1
HINTS
ENV SDLDIR
PATH_SUFFIXES lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
if(NOT SDL_BUILDING_LIBRARY)
@ -169,7 +154,24 @@ if(SDL_LIBRARY_TEMP)
set(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "")
endif()
if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h")
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MAJOR "${SDL_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MINOR "${SDL_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_VERSION_PATCH "${SDL_VERSION_PATCH_LINE}")
set(SDL_VERSION_STRING ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH})
unset(SDL_VERSION_MAJOR_LINE)
unset(SDL_VERSION_MINOR_LINE)
unset(SDL_VERSION_PATCH_LINE)
unset(SDL_VERSION_MAJOR)
unset(SDL_VERSION_MINOR)
unset(SDL_VERSION_PATCH)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR)
REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR
VERSION_VAR SDL_VERSION_STRING)

View File

@ -1,8 +1,14 @@
# Locate SDL_image library
# This module defines
# SDLIMAGE_LIBRARY, the name of the library to link against
# SDLIMAGE_FOUND, if false, do not try to link to SDL
# SDLIMAGE_INCLUDE_DIR, where to find SDL/SDL.h
# - Locate SDL_image library
# This module defines:
# SDL_IMAGE_LIBRARIES, the name of the library to link against
# SDL_IMAGE_INCLUDE_DIRS, where to find the headers
# SDL_IMAGE_FOUND, if false, do not try to link against
# SDL_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image
#
# For backward compatiblity the following variables are also set:
# SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES)
# SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS)
# SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
@ -14,6 +20,7 @@
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -25,40 +32,56 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(SDLIMAGE_INCLUDE_DIR SDL_image.h
if(NOT SDL_IMAGE_INCLUDE_DIR AND SDLIMAGE_INCLUDE_DIR)
set(SDL_IMAGE_INCLUDE_DIR ${SDLIMAGE_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
HINTS
ENV SDLIMAGEDIR
ENV SDLDIR
PATH_SUFFIXES include include/SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL12
/usr/local/include/SDL11 # FreeBSD ports
/usr/include/SDL12
/usr/include/SDL11
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
PATH_SUFFIXES SDL SDL12 SDL11
)
find_library(SDLIMAGE_LIBRARY
if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY)
set(SDL_IMAGE_LIBRARY ${SDLIMAGE_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_IMAGE_LIBRARY
NAMES SDL_image
HINTS
ENV SDLIMAGEDIR
ENV SDLDIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h")
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MAJOR "${SDL_IMAGE_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MINOR "${SDL_IMAGE_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_PATCH "${SDL_IMAGE_VERSION_PATCH_LINE}")
set(SDL_IMAGE_VERSION_STRING ${SDL_IMAGE_VERSION_MAJOR}.${SDL_IMAGE_VERSION_MINOR}.${SDL_IMAGE_VERSION_PATCH})
unset(SDL_IMAGE_VERSION_MAJOR_LINE)
unset(SDL_IMAGE_VERSION_MINOR_LINE)
unset(SDL_IMAGE_VERSION_PATCH_LINE)
unset(SDL_IMAGE_VERSION_MAJOR)
unset(SDL_IMAGE_VERSION_MINOR)
unset(SDL_IMAGE_VERSION_PATCH)
endif()
set(SDL_IMAGE_LIBRARIES ${SDL_IMAGE_LIBRARY})
set(SDL_IMAGE_INCLUDE_DIRS ${SDL_IMAGE_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLIMAGE
REQUIRED_VARS SDLIMAGE_LIBRARY SDLIMAGE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_image
REQUIRED_VARS SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS
VERSION_VAR SDL_IMAGE_VERSION_STRING)
# for backward compatiblity
set(SDLIMAGE_LIBRARY ${SDL_IMAGE_LIBRARIES})
set(SDLIMAGE_INCLUDE_DIR ${SDL_IMAGE_INCLUDE_DIRS})
set(SDLIMAGE_FOUND ${SDL_IMAGE_FOUND})
mark_as_advanced(SDL_IMAGE_LIBRARY SDL_IMAGE_INCLUDE_DIR)

View File

@ -1,8 +1,14 @@
# Locate SDL_mixer library
# This module defines
# SDLMIXER_LIBRARY, the name of the library to link against
# SDLMIXER_FOUND, if false, do not try to link to SDL
# SDLMIXER_INCLUDE_DIR, where to find SDL/SDL.h
# - Locate SDL_mixer library
# This module defines:
# SDL_MIXER_LIBRARIES, the name of the library to link against
# SDL_MIXER_INCLUDE_DIRS, where to find the headers
# SDL_MIXER_FOUND, if false, do not try to link against
# SDL_MIXER_VERSION_STRING - human-readable string containing the version of SDL_mixer
#
# For backward compatiblity the following variables are also set:
# SDLMIXER_LIBRARY (same value as SDL_MIXER_LIBRARIES)
# SDLMIXER_INCLUDE_DIR (same value as SDL_MIXER_INCLUDE_DIRS)
# SDLMIXER_FOUND (same value as SDL_MIXER_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
@ -14,6 +20,7 @@
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -25,40 +32,56 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(SDLMIXER_INCLUDE_DIR SDL_mixer.h
if(NOT SDL_MIXER_INCLUDE_DIR AND SDLMIXER_INCLUDE_DIR)
set(SDL_MIXER_INCLUDE_DIR ${SDLMIXER_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
HINTS
ENV SDLMIXERDIR
ENV SDLDIR
PATH_SUFFIXES include include/SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL12
/usr/local/include/SDL11 # FreeBSD ports
/usr/include/SDL12
/usr/include/SDL11
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
PATH_SUFFIXES SDL SDL12 SDL11
)
find_library(SDLMIXER_LIBRARY
if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY)
set(SDL_MIXER_LIBRARY ${SDLMIXER_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_MIXER_LIBRARY
NAMES SDL_mixer
HINTS
ENV SDLMIXERDIR
ENV SDLDIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h")
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MAJOR "${SDL_MIXER_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MINOR "${SDL_MIXER_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_PATCH "${SDL_MIXER_VERSION_PATCH_LINE}")
set(SDL_MIXER_VERSION_STRING ${SDL_MIXER_VERSION_MAJOR}.${SDL_MIXER_VERSION_MINOR}.${SDL_MIXER_VERSION_PATCH})
unset(SDL_MIXER_VERSION_MAJOR_LINE)
unset(SDL_MIXER_VERSION_MINOR_LINE)
unset(SDL_MIXER_VERSION_PATCH_LINE)
unset(SDL_MIXER_VERSION_MAJOR)
unset(SDL_MIXER_VERSION_MINOR)
unset(SDL_MIXER_VERSION_PATCH)
endif()
set(SDL_MIXER_LIBRARIES ${SDL_MIXER_LIBRARY})
set(SDL_MIXER_INCLUDE_DIRS ${SDL_MIXER_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLMIXER
REQUIRED_VARS SDLMIXER_LIBRARY SDLMIXER_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_mixer
REQUIRED_VARS SDL_MIXER_LIBRARIES SDL_MIXER_INCLUDE_DIRS
VERSION_VAR SDL_MIXER_VERSION_STRING)
# for backward compatiblity
set(SDLMIXER_LIBRARY ${SDL_MIXER_LIBRARIES})
set(SDLMIXER_INCLUDE_DIR ${SDL_MIXER_INCLUDE_DIRS})
set(SDLMIXER_FOUND ${SDL_MIXER_FOUND})
mark_as_advanced(SDL_MIXER_LIBRARY SDL_MIXER_INCLUDE_DIR)

View File

@ -1,8 +1,14 @@
# Locate SDL_net library
# This module defines
# SDLNET_LIBRARY, the name of the library to link against
# SDLNET_FOUND, if false, do not try to link against
# SDLNET_INCLUDE_DIR, where to find the headers
# - Locate SDL_net library
# This module defines:
# SDL_NET_LIBRARIES, the name of the library to link against
# SDL_NET_INCLUDE_DIRS, where to find the headers
# SDL_NET_FOUND, if false, do not try to link against
# SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net
#
# For backward compatiblity the following variables are also set:
# SDLNET_LIBRARY (same value as SDL_NET_LIBRARIES)
# SDLNET_INCLUDE_DIR (same value as SDL_NET_INCLUDE_DIRS)
# SDLNET_FOUND (same value as SDL_NET_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
@ -14,6 +20,7 @@
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -25,39 +32,56 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(SDLNET_INCLUDE_DIR SDL_net.h
if(NOT SDL_NET_INCLUDE_DIR AND SDLNET_INCLUDE_DIR)
set(SDL_NET_INCLUDE_DIR ${SDLNET_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_NET_INCLUDE_DIR SDL_net.h
HINTS
ENV SDLNETDIR
ENV SDLDIR
PATH_SUFFIXES include include/SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL12
/usr/local/include/SDL11 # FreeBSD ports
/usr/include/SDL12
/usr/include/SDL11
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
PATH_SUFFIXES SDL SDL12 SDL11
)
find_library(SDLNET_LIBRARY
if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY)
set(SDL_NET_LIBRARY ${SDLNET_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_NET_LIBRARY
NAMES SDL_net
HINTS
ENV SDLNETDIR
ENV SDLDIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h")
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MAJOR "${SDL_NET_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MINOR "${SDL_NET_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_PATCH "${SDL_NET_VERSION_PATCH_LINE}")
set(SDL_NET_VERSION_STRING ${SDL_NET_VERSION_MAJOR}.${SDL_NET_VERSION_MINOR}.${SDL_NET_VERSION_PATCH})
unset(SDL_NET_VERSION_MAJOR_LINE)
unset(SDL_NET_VERSION_MINOR_LINE)
unset(SDL_NET_VERSION_PATCH_LINE)
unset(SDL_NET_VERSION_MAJOR)
unset(SDL_NET_VERSION_MINOR)
unset(SDL_NET_VERSION_PATCH)
endif()
set(SDL_NET_LIBRARIES ${SDL_NET_LIBRARY})
set(SDL_NET_INCLUDE_DIRS ${SDL_NET_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLNET
REQUIRED_VARS SDLNET_LIBRARY SDLNET_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_net
REQUIRED_VARS SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS
VERSION_VAR SDL_NET_VERSION_STRING)
# for backward compatiblity
set(SDLNET_LIBRARY ${SDL_NET_LIBRARIES})
set(SDLNET_INCLUDE_DIR ${SDL_NET_INCLUDE_DIRS})
set(SDLNET_FOUND ${SDL_NET_FOUND})
mark_as_advanced(SDL_NET_LIBRARY SDL_NET_INCLUDE_DIR)

View File

@ -1,34 +1,34 @@
# Locates the SDL_sound library
# - Locates the SDL_sound library
#
# This module depends on SDL being found and
# must be called AFTER FindSDL.cmake is called.
#
# This module defines
# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
# SDL_SOUND_FOUND, if false, do not try to link to SDL
# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
# to link against. This is a read-only variable and is marked INTERNAL.
# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
# This is available mostly for cases this module failed to anticipate for
# and you must add additional flags. This is marked as ADVANCED.
# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
# SDL_SOUND_FOUND, if false, do not try to link to SDL_sound
# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
# to link against. This is a read-only variable and is marked INTERNAL.
# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
# This is available mostly for cases this module failed to anticipate for
# and you must add additional flags. This is marked as ADVANCED.
# SDL_SOUND_VERSION_STRING, human-readable string containing the version of SDL_sound
#
# This module also defines (but you shouldn't need to use directly)
# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.
# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.
# And might define the following as needed
# MIKMOD_LIBRARY
# MODPLUG_LIBRARY
# OGG_LIBRARY
# VORBIS_LIBRARY
# SMPEG_LIBRARY
# FLAC_LIBRARY
# SPEEX_LIBRARY
# MIKMOD_LIBRARY
# MODPLUG_LIBRARY
# OGG_LIBRARY
# VORBIS_LIBRARY
# SMPEG_LIBRARY
# FLAC_LIBRARY
# SPEEX_LIBRARY
#
# Typically, you should not use these variables directly, and you should use
# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries
# (if needed) to successfully compile on your system .
# (if needed) to successfully compile on your system.
#
# Created by Eric Wing.
# This module is a bit more complicated than the other FindSDL* family modules.
@ -54,10 +54,10 @@
# People will have to manually change the cache values of
# SDL_LIBRARY to override this selectionor set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -77,17 +77,7 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
PATH_SUFFIXES
include include/SDL
PATHS
/usr/local/include/SDL12
/usr/local/include/SDL11 # FreeBSD ports
/usr/include/SDL12
/usr/include/SDL11
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
PATH_SUFFIXES SDL SDL12 SDL11
)
find_library(SDL_SOUND_LIBRARY
@ -95,13 +85,6 @@ find_library(SDL_SOUND_LIBRARY
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
PATH_SUFFIXES
lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
@ -176,7 +159,8 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# in the SDL_LIBRARY string after the "-framework".
# But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work.
file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt
"project(DetermineSoundLibs)
"cmake_minimum_required(VERSION 2.8)
project(DetermineSoundLibs)
include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
add_executable(DetermineSoundLibs DetermineSoundLibs.c)
target_link_libraries(DetermineSoundLibs ${TMP_TRY_LIBS})"
@ -376,7 +360,24 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries")
endif()
if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SOUND_VER_MAJOR[ \t]+[0-9]+$")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MINOR_LINE REGEX "^#define[ \t]+SOUND_VER_MINOR[ \t]+[0-9]+$")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_PATCH_LINE REGEX "^#define[ \t]+SOUND_VER_PATCH[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MAJOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MAJOR "${SDL_SOUND_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MINOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MINOR "${SDL_SOUND_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_PATCH[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_PATCH "${SDL_SOUND_VERSION_PATCH_LINE}")
set(SDL_SOUND_VERSION_STRING ${SDL_SOUND_VERSION_MAJOR}.${SDL_SOUND_VERSION_MINOR}.${SDL_SOUND_VERSION_PATCH})
unset(SDL_SOUND_VERSION_MAJOR_LINE)
unset(SDL_SOUND_VERSION_MINOR_LINE)
unset(SDL_SOUND_VERSION_PATCH_LINE)
unset(SDL_SOUND_VERSION_MAJOR)
unset(SDL_SOUND_VERSION_MINOR)
unset(SDL_SOUND_VERSION_PATCH)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_SOUND
REQUIRED_VARS SDL_SOUND_LIBRARIES SDL_SOUND_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound
REQUIRED_VARS SDL_SOUND_LIBRARY SDL_SOUND_INCLUDE_DIR
VERSION_VAR SDL_SOUND_VERSION_STRING)

View File

@ -1,8 +1,14 @@
# Locate SDL_ttf library
# This module defines
# SDLTTF_LIBRARY, the name of the library to link against
# SDLTTF_FOUND, if false, do not try to link to SDL
# SDLTTF_INCLUDE_DIR, where to find SDL/SDL.h
# - Locate SDL_ttf library
# This module defines:
# SDL_TTF_LIBRARIES, the name of the library to link against
# SDL_TTF_INCLUDE_DIRS, where to find the headers
# SDL_TTF_FOUND, if false, do not try to link against
# SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf
#
# For backward compatiblity the following variables are also set:
# SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES)
# SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS)
# SDLTTF_FOUND (same value as SDL_TTF_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
@ -14,6 +20,7 @@
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@ -25,40 +32,56 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(SDLTTF_INCLUDE_DIR SDL_ttf.h
if(NOT SDL_TTF_INCLUDE_DIR AND SDLTTF_INCLUDE_DIR)
set(SDL_TTF_INCLUDE_DIR ${SDLTTF_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
HINTS
ENV SDLTTFDIR
ENV SDLDIR
PATH_SUFFIXES include include/SDL
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL12
/usr/local/include/SDL11 # FreeBSD ports
/usr/include/SDL12
/usr/include/SDL11
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
PATH_SUFFIXES SDL SDL12 SDL11
)
find_library(SDLTTF_LIBRARY
if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY)
set(SDL_TTF_LIBRARY ${SDLTTF_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_TTF_LIBRARY
NAMES SDL_ttf
HINTS
ENV SDLTTFDIR
ENV SDLDIR
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h")
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MAJOR "${SDL_TTF_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MINOR "${SDL_TTF_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_PATCH "${SDL_TTF_VERSION_PATCH_LINE}")
set(SDL_TTF_VERSION_STRING ${SDL_TTF_VERSION_MAJOR}.${SDL_TTF_VERSION_MINOR}.${SDL_TTF_VERSION_PATCH})
unset(SDL_TTF_VERSION_MAJOR_LINE)
unset(SDL_TTF_VERSION_MINOR_LINE)
unset(SDL_TTF_VERSION_PATCH_LINE)
unset(SDL_TTF_VERSION_MAJOR)
unset(SDL_TTF_VERSION_MINOR)
unset(SDL_TTF_VERSION_PATCH)
endif()
set(SDL_TTF_LIBRARIES ${SDL_TTF_LIBRARY})
set(SDL_TTF_INCLUDE_DIRS ${SDL_TTF_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLTTF
REQUIRED_VARS SDLTTF_LIBRARY SDLTTF_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_ttf
REQUIRED_VARS SDL_TTF_LIBRARIES SDL_TTF_INCLUDE_DIRS
VERSION_VAR SDL_TTF_VERSION_STRING)
# for backward compatiblity
set(SDLTTF_LIBRARY ${SDL_TTF_LIBRARIES})
set(SDLTTF_INCLUDE_DIR ${SDL_TTF_INCLUDE_DIRS})
set(SDLTTF_FOUND ${SDL_TTF_FOUND})
mark_as_advanced(SDL_TTF_LIBRARY SDL_TTF_INCLUDE_DIR)