hedgewars/CMakeLists.txt
changeset 8686 d303da4568b7
parent 8669 3f9853888d4f
child 8688 88a6114a318c
equal deleted inserted replaced
8685:c0e54583296e 8686:d303da4568b7
   118 else(${BUILD_ENGINE_LIBRARY})
   118 else(${BUILD_ENGINE_LIBRARY})
   119     set(destination_dir ${target_binary_install_dir})
   119     set(destination_dir ${target_binary_install_dir})
   120 endif(${BUILD_ENGINE_LIBRARY})
   120 endif(${BUILD_ENGINE_LIBRARY})
   121 
   121 
   122 
   122 
   123 find_package(FreePascal REQUIRED)
   123 include(${CMAKE_MODULE_PATH}/utils.cmake)
       
   124 
       
   125 find_package_or_fail(FreePascal)
       
   126 
   124 #when cmake-2.6 support is dropped, this ought to be inside FindFreePascal.cmake
   127 #when cmake-2.6 support is dropped, this ought to be inside FindFreePascal.cmake
   125 if (FREEPASCAL_VERSION VERSION_LESS required_fpc_version)
   128 if (FREEPASCAL_VERSION VERSION_LESS required_fpc_version)
   126     message(FATAL_ERROR "Freepascal ${FREEPASCAL_VERSION} is too old, minimum version required is ${required_fpc_version}")
   129     message(FATAL_ERROR "Freepascal ${FREEPASCAL_VERSION} is too old, minimum version required is ${required_fpc_version}")
   127 endif()
   130 endif()
   128 
   131 
   161     get_filename_component(compiler_dir ${CMAKE_C_COMPILER} PATH)
   164     get_filename_component(compiler_dir ${CMAKE_C_COMPILER} PATH)
   162     list(APPEND pascal_flags "-FD${compiler_dir}")
   165     list(APPEND pascal_flags "-FD${compiler_dir}")
   163 endif(APPLE)
   166 endif(APPLE)
   164 
   167 
   165 if(NOT NOPNG)
   168 if(NOT NOPNG)
   166     find_package(PNG)
   169     find_package_or_disable(PNG NOPNG)
   167     if(${PNG_FOUND})
   170     list(APPEND pascal_flags "-dPNG_SCREENSHOTS")
   168         list(APPEND pascal_flags "-dPNG_SCREENSHOTS")
   171 else()
   169         if(APPLE)  # fpc png unit doesn't pull the library (see bug 21833)
   172     message(STATUS "PNG screenshots disabled, using BMP format")
   170             list(APPEND pascal_flags "-k${PNG_LIBRARY}")
       
   171         endif()
       
   172     else()
       
   173         message(${WARNING} "Screenshots will be in BMP format because libpng was not found")
       
   174     endif()
       
   175 else()
       
   176     message(STATUS "Screenshots will be in BMP format per user request")
       
   177 endif()
   173 endif()
   178 
   174 
   179 
   175 
   180 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   176 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   181 if(FREEPASCAL_VERSION VERSION_LESS "2.6")
   177 if(FREEPASCAL_VERSION VERSION_LESS "2.6")