creaturesImage work: add mutableCopy and tint methods to the base class (and change...
[openc2e.git] / cmake / FindSDL_gfx.cmake
blob79da860d1fcda20fec858e77f7376d43d97de038
1 # ***************************************************************************
2 # *   Copyright (C) 2007 The OpenAnno team                                  *
3 # *   team@openanno.org                                                     *
4 # *                                                                         *
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.                                   *
9 # *                                                                         *
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.                          *
14 # *                                                                         *
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
22 # This module defines
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
26 #   
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 
31 # module.
32 FIND_PATH(SDLGFX_INCLUDE_DIR SDL_rotozoom.h
33   $ENV{SDLGFXDIR}/include
34   $ENV{SDLDIR}/include
35   ~/Library/Frameworks/SDL_gfx.framework/Headers
36   /Library/Frameworks/SDL_gfx.framework/Headers
37   /usr/local/include/SDL
38   /usr/include/SDL
39   /usr/local/include/SDL12
40   /usr/local/include/SDL11 # FreeBSD ports
41   /usr/include/SDL12
42   /usr/include/SDL11
43   /usr/local/include
44   /usr/include
45   /sw/include/SDL # Fink
46   /sw/include
47   /opt/local/include/SDL # DarwinPorts
48   /opt/local/include
49   /opt/csw/include/SDL # Blastwave
50   /opt/csw/include 
51   /opt/include/SDL
52   /opt/include
53   )
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"
63       )
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"
68       )
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"
73     )
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 
79     NAMES SDL_gfx
80     PATHS
81     $ENV{SDLGFXDIR}/lib
82     $ENV{SDLDIR}/lib
83     /usr/local/lib
84     /usr/lib
85     /sw/lib
86     /opt/local/lib
87     /opt/csw/lib
88     /opt/lib
89     )
90 ENDIF(${SDLGFX_INCLUDE_DIR} MATCHES ".framework")
92 SET(SDLGFX_FOUND "NO")
93 IF(SDLGFX_LIBRARY)
94   SET(SDLGFX_FOUND "YES")
95 ENDIF(SDLGFX_LIBRARY)