this should enable png screenshots on osx as well
authorkoda
Tue, 24 Apr 2012 06:53:39 +0200
changeset 6920 b1d0d26d41fa
parent 6919 bf7433e62b9c
child 6921 e6033fe39b7f
this should enable png screenshots on osx as well
hedgewars/CMakeLists.txt
--- a/hedgewars/CMakeLists.txt	Mon Apr 23 19:23:28 2012 +0200
+++ b/hedgewars/CMakeLists.txt	Tue Apr 24 06:53:39 2012 +0200
@@ -142,9 +142,16 @@
     message(FATAL_ERROR "No Pascal compiler found!")
 endif()
 
+
+#DEPENDECIES AND EXECUTABLES SECTION
 find_package(PNG)
 if(${PNG_FOUND})
+    message(STATUS "PNG screenshots enabled (library found at ${PNG_LIBRARY})")
     set(pascal_compiler_flags_cmn "-dPNG_SCREENSHOTS" ${pascal_compiler_flags_cmn})
+    if(APPLE)  # need to explictly link with the static lib
+        string(REGEX REPLACE "(.*)libpng.*" "\\1" PNG_LIBDIR "${PNG_LIBRARY}")
+        set(pascal_compiler_flags_cmn "-k${PNG_LIBDIR}/libpng.a" ${pascal_compiler_flags_cmn})
+    endif()
 else()
     message(STATUS "PNG library not found, switching to screenshots in BMP format")
 endif()
@@ -153,7 +160,6 @@
 set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
 
 
-#DEPENDECIES AND EXECUTABLES SECTION
 IF(NOT APPLE)
     #here is the command for standard executables or for shared library
     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"