Mercurial > malikania
annotate cmake/packages/FindSDL2_image.cmake @ 73:efe1a7fb43f8
Misc: fix some code style
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 22 Dec 2016 09:27:09 +0100 |
parents | d4f5f7231b84 |
children |
rev | line source |
---|---|
33
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
1 # - Locate SDL_image library |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
2 # This module defines: |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
3 # SDL2_IMAGE_LIBRARIES, the name of the library to link against |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
4 # SDL2_IMAGE_INCLUDE_DIRS, where to find the headers |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
5 # SDL2_IMAGE_FOUND, if false, do not try to link against |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
6 # SDL2_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
7 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
8 # $SDLDIR is an environment variable that would |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
9 # correspond to the ./configure --prefix=$SDLDIR |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
10 # used in building SDL. |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
11 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
12 # Created by Eric Wing. This was influenced by the FindSDL.cmake |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
13 # module, but with modifications to recognize OS X frameworks and |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
14 # additional Unix paths (FreeBSD, etc). |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
15 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
16 #============================================================================= |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
17 # Copyright 2005-2009 Kitware, Inc. |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
18 # Copyright 2012 Benjamin Eikel |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
19 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
20 # Distributed under the OSI-approved BSD License (the "License"); |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
21 # see accompanying file Copyright.txt for details. |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
22 # |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
23 # This software is distributed WITHOUT ANY WARRANTY; without even the |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
24 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
25 # See the License for more information. |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
26 #============================================================================= |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
27 # (To distribute this file outside of CMake, substitute the full |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
28 # License text for the above reference.) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
29 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
30 find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
31 HINTS |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
32 ENV SDLIMAGEDIR |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
33 ENV SDLDIR |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
34 PATH_SUFFIXES include/SDL2 include/SDL2.0 include |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
35 ) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
36 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
37 find_library(SDL2_IMAGE_LIBRARY |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
38 NAMES SDL2_image SDL2_image-2.0 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
39 HINTS |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
40 ENV SDLIMAGEDIR |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
41 ENV SDLDIR |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
42 PATH_SUFFIXES lib |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
43 ) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
44 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
45 if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h") |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
46 file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
47 file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
48 file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
49 string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}") |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
50 string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}") |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
51 string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}") |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
52 set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH}) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
53 unset(SDL2_IMAGE_VERSION_MAJOR_LINE) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
54 unset(SDL2_IMAGE_VERSION_MINOR_LINE) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
55 unset(SDL2_IMAGE_VERSION_PATCH_LINE) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
56 unset(SDL2_IMAGE_VERSION_MAJOR) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
57 unset(SDL2_IMAGE_VERSION_MINOR) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
58 unset(SDL2_IMAGE_VERSION_PATCH) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
59 endif() |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
60 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
61 set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY}) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
62 set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR}) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
63 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
64 include(FindPackageHandleStandardArgs) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
65 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
66 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
67 REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
68 VERSION_VAR SDL2_IMAGE_VERSION_STRING) |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
69 |
d4f5f7231b84
Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
70 mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR) |