--- a/hedgewars/CMakeLists.txt Thu Oct 25 01:16:13 2012 +0200
+++ b/hedgewars/CMakeLists.txt Thu Oct 25 05:06:00 2012 +0200
@@ -3,8 +3,6 @@
find_package(SDL_net)
find_package(SDL_ttf)
find_package(SDL_mixer)
-set(FFMPEG_FIND_QUIETLY true)
-find_package(FFMPEG)
include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake)
@@ -163,7 +161,7 @@
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
- message(STATUS "Freepascal version installed: ${fpc_vers_major}.${fpc_vers_minor}")
+ message(STATUS "Found Freepascal: ${fpc_executable} (version ${fpc_vers_major}.${fpc_vers_minor})")
math(EXPR fpc_version "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
if(fpc_version LESS "020200")
@@ -181,9 +179,8 @@
find_package(PNG)
if(${PNG_FOUND})
set(pascal_flags "-dPNG_SCREENSHOTS" ${pascal_flags})
- if(APPLE) # easier to explictly link with the static lib
- string(REGEX REPLACE "(.*)libpng.*" "\\1" PNG_LIBDIR "${PNG_LIBRARY}")
- set(pascal_flags "-k${PNG_LIBDIR}/libpng.a" ${pascal_flags})
+ if(APPLE) # fpc png unit doesn't pull the library (see bug 21833)
+ set(pascal_flags "-k${PNG_LIBRARY}" ${pascal_flags})
endif()
else()
message(STATUS "Screenshots will be in BMP format because libpng was not found")
@@ -201,6 +198,8 @@
if(NOT NOVIDEOREC)
+ set(FFMPEG_FIND_QUIETLY true)
+ find_package(FFMPEG)
if(${FFMPEG_FOUND})
include_directories(${FFMPEG_INCLUDE_DIR})
set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
@@ -262,10 +261,8 @@
endif()
#this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
-if(fpc_version LESS "020600")
- if(NO_VIDEOREC OR NOT ${FFMPEG_FOUND})
- add_dependencies(${engine_output_name} ENGINECLEAN)
- endif()
+if((fpc_version LESS "020600") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
+ add_dependencies(${engine_output_name} ENGINECLEAN)
endif()
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})