Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 367 lines (327 sloc) 17.563 kb
f24ca9a @TankOs Source code changes.
TankOs authored
1 # This script locates the SFML library
2 # ------------------------------------
3 #
4 # Usage
5 # -----
6 #
7 # When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
8 # If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
9 # example:
10 # find_package(SFML COMPONENTS graphics window system) // find the graphics, window and system modules
11 #
12 # You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
45810a1 @eXpl0it3r Fixed additional comments and documention spelling mistakes.
eXpl0it3r authored
13 # If nothing is specified, the version won't be checked (i.e. any version will be accepted).
f24ca9a @TankOs Source code changes.
TankOs authored
14 # example:
15 # find_package(SFML COMPONENTS ...) // no specific version required
16 # find_package(SFML 2 COMPONENTS ...) // any 2.x version
17 # find_package(SFML 2.4 COMPONENTS ...) // version 2.4 or greater
18 #
19 # By default, the dynamic libraries of SFML will be found. To find the static ones instead,
20 # you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
21 # Since you have to link yourself all the SFML dependencies when you link it statically, the following
22 # additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
23 # description below).
24 # In case of static linking, the SFML_STATIC macro will also be defined by this script.
25 # example:
26 # set(SFML_STATIC_LIBRARIES TRUE)
27 # find_package(SFML 2 COMPONENTS network system)
28 #
29 # On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
30 # CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
31 # Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
32 # are available for both release and debug modes.
33 #
34 # If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
35 # to tell CMake where SFML is.
36 #
37 # Output
38 # ------
39 #
40 # This script defines the following variables:
41 # - For each specified module XXX (system, window, graphics, network, audio, main):
42 # - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
43 # - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
44 # - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
45 # - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
46 # - SFML_XXX_DEPENDENCIES: the list of libraries the module depends on, in case of static linking
47 # - SFML_LIBRARIES: the list of all libraries corresponding to the required modules
48 # - SFML_FOUND: true if all the required modules are found
49 # - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
50 # - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
51 #
52 # example:
53 # find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
54 # include_directories(${SFML_INCLUDE_DIR})
55 # add_executable(myapp ...)
56 # target_link_libraries(myapp ${SFML_LIBRARIES})
57
58 # define the SFML_STATIC macro if static build was chosen
59 if(SFML_STATIC_LIBRARIES)
60 add_definitions(-DSFML_STATIC)
61 endif()
62
63 # define the list of search paths for headers and libraries
64 set(FIND_SFML_PATHS
65 ${SFML_ROOT}
66 $ENV{SFML_ROOT}
67 ~/Library/Frameworks
68 /Library/Frameworks
69 /usr/local
70 /usr
71 /sw
72 /opt/local
73 /opt/csw
74 /opt)
75
76 # find the SFML include directory
77 find_path(SFML_INCLUDE_DIR SFML/Config.hpp
78 PATH_SUFFIXES include
79 PATHS ${FIND_SFML_PATHS})
80
81 # check the version number
82 set(SFML_VERSION_OK TRUE)
83 if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
84 # extract the major and minor version numbers from SFML/Config.hpp
85 # we have to handle framework a little bit differently:
86 if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
87 set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
88 else()
89 set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
90 endif()
91 FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
1c46ec7 @eXpl0it3r Updated the version to 2.2, added support for patch versions and added t...
eXpl0it3r authored
92 STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*#define SFML_VERSION_PATCH ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}")
f24ca9a @TankOs Source code changes.
TankOs authored
93 STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
94 STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
1c46ec7 @eXpl0it3r Updated the version to 2.2, added support for patch versions and added t...
eXpl0it3r authored
95 STRING(REGEX REPLACE ".*#define SFML_VERSION_PATCH ([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}")
96 math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}")
f24ca9a @TankOs Source code changes.
TankOs authored
97
98 # if we could extract them, compare with the requested version number
99 if (SFML_VERSION_MAJOR)
100 # transform version numbers to an integer
1c46ec7 @eXpl0it3r Updated the version to 2.2, added support for patch versions and added t...
eXpl0it3r authored
101 math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}")
f24ca9a @TankOs Source code changes.
TankOs authored
102
103 # compare them
104 if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
105 set(SFML_VERSION_OK FALSE)
106 endif()
107 else()
108 # SFML version is < 2.0
1c46ec7 @eXpl0it3r Updated the version to 2.2, added support for patch versions and added t...
eXpl0it3r authored
109 if (SFML_REQUESTED_VERSION GREATER 10900)
f24ca9a @TankOs Source code changes.
TankOs authored
110 set(SFML_VERSION_OK FALSE)
111 set(SFML_VERSION_MAJOR 1)
112 set(SFML_VERSION_MINOR x)
1c46ec7 @eXpl0it3r Updated the version to 2.2, added support for patch versions and added t...
eXpl0it3r authored
113 set(SFML_VERSION_PATCH x)
f24ca9a @TankOs Source code changes.
TankOs authored
114 endif()
115 endif()
116 endif()
117
118 # find the requested modules
119 set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
120 foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
121 string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
122 string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
123 set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
124
125 # no suffix for sfml-main, it is always a static library
126 if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
127 # release library
128 find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
129 NAMES ${FIND_SFML_COMPONENT_NAME}
130 PATH_SUFFIXES lib64 lib
131 PATHS ${FIND_SFML_PATHS})
132
133 # debug library
134 find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
135 NAMES ${FIND_SFML_COMPONENT_NAME}-d
136 PATH_SUFFIXES lib64 lib
137 PATHS ${FIND_SFML_PATHS})
138 else()
139 # static release library
140 find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
141 NAMES ${FIND_SFML_COMPONENT_NAME}-s
142 PATH_SUFFIXES lib64 lib
143 PATHS ${FIND_SFML_PATHS})
144
145 # static debug library
146 find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
147 NAMES ${FIND_SFML_COMPONENT_NAME}-s-d
148 PATH_SUFFIXES lib64 lib
149 PATHS ${FIND_SFML_PATHS})
150
151 # dynamic release library
152 find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
153 NAMES ${FIND_SFML_COMPONENT_NAME}
154 PATH_SUFFIXES lib64 lib
155 PATHS ${FIND_SFML_PATHS})
156
157 # dynamic debug library
158 find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG
159 NAMES ${FIND_SFML_COMPONENT_NAME}-d
160 PATH_SUFFIXES lib64 lib
161 PATHS ${FIND_SFML_PATHS})
162
163 # choose the entries that fit the requested link type
164 if(SFML_STATIC_LIBRARIES)
165 if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE)
166 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE})
167 endif()
168 if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG)
169 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG})
170 endif()
171 else()
172 if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE)
173 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE})
174 endif()
175 if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
176 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG})
177 endif()
178 endif()
179 endif()
180
181 if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
182 # library found
183 set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
e80bf0b @binary1248 Fix whitespace: Convert tabs to spaces and remove trailing whitespace.
binary1248 authored
184
f24ca9a @TankOs Source code changes.
TankOs authored
185 # if both are found, set SFML_XXX_LIBRARY to contain both
186 if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
187 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
188 optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
189 endif()
190
191 # if only one debug/release variant is found, set the other to be equal to the found one
192 if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
193 # debug and not release
194 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
195 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
196 endif()
197 if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
198 # release and not debug
199 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
200 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
201 endif()
202 else()
203 # library not found
204 set(SFML_FOUND FALSE)
205 set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
206 set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
207 set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
208 endif()
209
210 # mark as advanced
211 MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
212 SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
213 SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
214 SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
215 SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
216 SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
217 SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
218
219 # add to the global list of libraries
220 set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
221 endforeach()
222
223 # in case of static linking, we must also define the list of all the dependencies of SFML libraries
224 if(SFML_STATIC_LIBRARIES)
225
226 # detect the OS
227 if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
228 set(FIND_SFML_OS_WINDOWS 1)
229 elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
230 set(FIND_SFML_OS_LINUX 1)
231 elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
232 set(FIND_SFML_OS_FREEBSD 1)
233 elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
234 set(FIND_SFML_OS_MACOSX 1)
235 endif()
236
237 # start with an empty list
238 set(SFML_DEPENDENCIES)
239 set(FIND_SFML_DEPENDENCIES_NOTFOUND)
240
241 # macro that searches for a 3rd-party library
242 macro(find_sfml_dependency output friendlyname)
c0bee34 @Bromeon FindSFML.cmake: Ignored environment variables to find library paths
Bromeon authored
243 # No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
244 find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
f24ca9a @TankOs Source code changes.
TankOs authored
245 if(${${output}} STREQUAL "${output}-NOTFOUND")
246 unset(output)
247 set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
248 endif()
249 endmacro()
250
251 # sfml-system
252 list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT)
253 if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1)
254
255 # update the list -- these are only system libraries, no need to find them
256 if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX)
257 set(SFML_SYSTEM_DEPENDENCIES "pthread")
258 endif()
259 if(FIND_SFML_OS_LINUX)
66f3826 @nullEuro Fixed missing pthread dependency
nullEuro authored
260 set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt")
f24ca9a @TankOs Source code changes.
TankOs authored
261 endif()
262 if(FIND_SFML_OS_WINDOWS)
263 set(SFML_SYSTEM_DEPENDENCIES "winmm")
264 endif()
265 set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES})
266 endif()
267
268 # sfml-network
269 list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT)
270 if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1)
271
272 # update the list -- these are only system libraries, no need to find them
273 if(FIND_SFML_OS_WINDOWS)
274 set(SFML_NETWORK_DEPENDENCIES "ws2_32")
275 endif()
276 set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES})
277 endif()
278
279 # sfml-window
280 list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT)
281 if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1)
282
283 # find libraries
3ec672a @binary1248 Removed XCB dependencies (EWMH, ICCCM, Keysyms, Util), added XCB librari...
binary1248 authored
284 if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
f24ca9a @TankOs Source code changes.
TankOs authored
285 find_sfml_dependency(X11_LIBRARY "X11" X11)
3ec672a @binary1248 Removed XCB dependencies (EWMH, ICCCM, Keysyms, Util), added XCB librari...
binary1248 authored
286 find_sfml_dependency(LIBXCB_LIBRARIES "XCB" xcb libxcb)
287 find_sfml_dependency(X11_XCB_LIBRARY "X11-xcb" X11-xcb libX11-xcb)
288 find_sfml_dependency(XCB_RANDR_LIBRARY "xcb-randr" xcb-randr libxcb-randr)
289 find_sfml_dependency(XCB_IMAGE_LIBRARY "xcb-image" xcb-image libxcb-image)
290 endif()
291
292 if(FIND_SFML_OS_LINUX)
293 find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev)
f24ca9a @TankOs Source code changes.
TankOs authored
294 endif()
295
296 # update the list
297 if(FIND_SFML_OS_WINDOWS)
298 set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32")
3ec672a @binary1248 Removed XCB dependencies (EWMH, ICCCM, Keysyms, Util), added XCB librari...
binary1248 authored
299 elseif(FIND_SFML_OS_LINUX)
300 set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${LIBXCB_LIBRARIES} ${X11_XCB_LIBRARY} ${XCB_RANDR_LIBRARY} ${XCB_IMAGE_LIBRARY} ${UDEV_LIBRARIES})
301 elseif(FIND_SFML_OS_FREEBSD)
302 set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${LIBXCB_LIBRARIES} ${X11_XCB_LIBRARY} ${XCB_RANDR_LIBRARY} ${XCB_IMAGE_LIBRARY} "usbhid")
f24ca9a @TankOs Source code changes.
TankOs authored
303 elseif(FIND_SFML_OS_MACOSX)
304 set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon")
305 endif()
306 set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES})
307 endif()
308
309 # sfml-graphics
310 list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT)
311 if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1)
e80bf0b @binary1248 Fix whitespace: Convert tabs to spaces and remove trailing whitespace.
binary1248 authored
312
f24ca9a @TankOs Source code changes.
TankOs authored
313 # find libraries
314 find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
315 find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg)
316
317 # update the list
3e397bf @binary1248 Replaced GLEW with (a highly customized) loader generated by glLoadGen, ...
binary1248 authored
318 set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
f24ca9a @TankOs Source code changes.
TankOs authored
319 set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
320 endif()
321
322 # sfml-audio
323 list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT)
324 if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1)
325
326 # find libraries
327 find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32)
f0608ea @LaurentGomila Redesigned the audio encoding/decoding classes to get rid of libsndfile
LaurentGomila authored
328 find_sfml_dependency(OGG_LIBRARY "Ogg" ogg)
329 find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis)
330 find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile)
5ce73e9 @Bromeon FindSFML.cmake: Added missing VorbisEnc dependency
Bromeon authored
331 find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc)
5e0e645 @LaurentGomila Added support for FLAC audio files
LaurentGomila authored
332 find_sfml_dependency(FLAC_LIBRARY "FLAC" flac)
f24ca9a @TankOs Source code changes.
TankOs authored
333
334 # update the list
5ce73e9 @Bromeon FindSFML.cmake: Added missing VorbisEnc dependency
Bromeon authored
335 set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
f0608ea @LaurentGomila Redesigned the audio encoding/decoding classes to get rid of libsndfile
LaurentGomila authored
336 set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES})
f24ca9a @TankOs Source code changes.
TankOs authored
337 endif()
338
339 endif()
340
341 # handle errors
342 if(NOT SFML_VERSION_OK)
343 # SFML version not ok
1c46ec7 @eXpl0it3r Updated the version to 2.2, added support for patch versions and added t...
eXpl0it3r authored
344 set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})")
f24ca9a @TankOs Source code changes.
TankOs authored
345 set(SFML_FOUND FALSE)
346 elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND)
347 set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
348 set(SFML_FOUND FALSE)
349 elseif(NOT SFML_FOUND)
350 # include directory or library not found
351 set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
352 endif()
353 if (NOT SFML_FOUND)
354 if(SFML_FIND_REQUIRED)
355 # fatal error
356 message(FATAL_ERROR ${FIND_SFML_ERROR})
357 elseif(NOT SFML_FIND_QUIETLY)
358 # error but continue
359 message("${FIND_SFML_ERROR}")
360 endif()
361 endif()
362
363 # handle success
f44c903 @danijar Hide CMake success message in quiet mode
danijar authored
364 if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
1c46ec7 @eXpl0it3r Updated the version to 2.2, added support for patch versions and added t...
eXpl0it3r authored
365 message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
f24ca9a @TankOs Source code changes.
TankOs authored
366 endif()
Something went wrong with that request. Please try again.