1 # ***************************************************************************
2 # * Copyright (C) 2007 The OpenAnno team *
3 # * team@openanno.org *
5 # * This program is free software; you can redistribute it and/or modify *
6 # * it under the terms of the GNU General Public License as published by *
7 # * the Free Software Foundation; either version 2 of the License, or *
8 # * (at your option) any later version. *
10 # * This program is distributed in the hope that it will be useful, *
11 # * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 # * GNU General Public License for more details. *
15 # * You should have received a copy of the GNU General Public License *
16 # * along with this program; if not, write to the *
17 # * Free Software Foundation, Inc., *
18 # * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 # ***************************************************************************
21 # - Locate SDL_gfx library
23 # SDLGFX_LIBRARY, the library to link against
24 # SDLGFX_FOUND, if false, do not try to link to SDL_gfx
25 # SDLGFX_INCLUDE_DIR, where to find e.g. SDL/SDL_rotozoom.h
27 # $SDLDIR is an environment variable that would
28 # correspond to the ./configure --prefix=$SDLDIR
29 # used in building SDL.
30 # Created by Philipp Kerling. This was influenced by the FindSDL_ttf.cmake
32 FIND_PATH(SDLGFX_INCLUDE_DIR SDL_rotozoom.h
33 $ENV{SDLGFXDIR}/include
35 ~/Library/Frameworks/SDL_gfx.framework/Headers
36 /Library/Frameworks/SDL_gfx.framework/Headers
37 /usr/local/include/SDL
39 /usr/local/include/SDL12
40 /usr/local/include/SDL11 # FreeBSD ports
45 /sw/include/SDL # Fink
47 /opt/local/include/SDL # DarwinPorts
49 /opt/csw/include/SDL # Blastwave
54 # I'm not sure if I should do a special casing for Apple. It is
55 # unlikely that other Unix systems will find the framework path.
56 # But if they do ([Next|Open|GNU]Step?),
57 # do they want the -framework option also?
58 IF(${SDLGFX_INCLUDE_DIR} MATCHES ".framework")
59 # Extract the path the framework resides in so we can use it for the -F flag
60 STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDLGFX_FRAMEWORK_PATH_TEMP ${SDLGFX_INCLUDE_DIR})
61 IF("${SDLGFX_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
62 OR "${SDLGFX_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
64 # String is in default search path, don't need to use -F
65 SET(SDLGFX_LIBRARY "-framework SDL_gfx" CACHE STRING "SDL_gfx framework for OSX")
66 ELSE("${SDLGFX_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
67 OR "${SDLGFX_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
69 # String is not /Library/Frameworks, need to use -F
70 SET(SDLGFX_LIBRARY "-F${SDLGFX_FRAMEWORK_PATH_TEMP} -framework SDL_gfx" CACHE STRING "SDL_gfx framework for OSX")
71 ENDIF("${SDLGFX_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
72 OR "${SDLGFX_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
74 # Clear the temp variable so nobody can see it
75 SET(SDLGFX_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "")
77 ELSE(${SDLGFX_INCLUDE_DIR} MATCHES ".framework")
78 FIND_LIBRARY(SDLGFX_LIBRARY
90 ENDIF(${SDLGFX_INCLUDE_DIR} MATCHES ".framework")
92 SET(SDLGFX_FOUND "NO")
94 SET(SDLGFX_FOUND "YES")