hedgewars/CMakeLists.txt
changeset 2672 0f1403bf267a
parent 2671 7e0f88013fe8
child 2673 2c847bcc951d
--- a/hedgewars/CMakeLists.txt	Sun Jan 03 15:40:41 2010 +0000
+++ b/hedgewars/CMakeLists.txt	Sun Jan 03 17:23:40 2010 +0000
@@ -6,6 +6,25 @@
 find_package(SDL_ttf)
 find_package(SDL_mixer)
 
+#find which version of SDL_image and SDL_mixer we have (for IMG_Init and Mix_Init)
+#if the headers are not installed, the newer apis won't be activated
+find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_LIBRARY})
+file(STRINGS ${sdlmixer_h} sdlmixer_version_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+")
+string(REGEX MATCH ".([0-9]+)" sdlmixer_version "${sdlmixer_version_tmp}")
+
+if(sdlmixer_version GREATER 9)
+message(STATUS "Enabling enhanced SDL_Mixer calls")
+set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn})
+endif()
+
+find_file(sdlimage_h SDL_image.h ${SDLIMAGE_LIBRARY})
+file(STRINGS ${sdlimage_h} sdlimage_version_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+")
+string(REGEX MATCH ".([0-9]+)" sdlimage_version "${sdlimage_version_tmp}")
+
+if(sdlimage_version GREATER 7)
+message(STATUS "Enabling enhanced SDL_Image calls")
+set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn})
+endif()
 
 #SOURCE AND PROGRAMS SECTION 
 set(fpc_tryexe fpc)