--- a/cmake_modules/CMakeDeterminePascalCompiler.cmake Tue Mar 26 01:18:04 2013 +0100
+++ b/cmake_modules/CMakeDeterminePascalCompiler.cmake Tue Mar 26 01:43:34 2013 +0100
@@ -41,6 +41,14 @@
ENDIF(NOT CMAKE_Pascal_COMPILER)
MARK_AS_ADVANCED(CMAKE_Pascal_COMPILER)
+if(NOT CMAKE_Pascal_COMPILER_VERSION)
+ execute_process(COMMAND ${CMAKE_Pascal_COMPILER} -iV
+ OUTPUT_VARIABLE CMAKE_Pascal_COMPILER_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ) # we assume no error for something so simple
+endif(NOT CMAKE_Pascal_COMPILER_VERSION)
+mark_as_advanced(CMAKE_Pascal_COMPILER_VERSION)
+
GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_Pascal_COMPILER}" PATH)
# configure variables set in this file for fast reload later on
--- a/cmake_modules/CMakePascalCompiler.cmake.in Tue Mar 26 01:18:04 2013 +0100
+++ b/cmake_modules/CMakePascalCompiler.cmake.in Tue Mar 26 01:43:34 2013 +0100
@@ -1,6 +1,7 @@
SET(CMAKE_Pascal_COMPILER "@CMAKE_Pascal_COMPILER@")
SET(CMAKE_Pascal_COMPILER_ARG1 "@CMAKE_Pascal_COMPILER_ARG1@")
SET(CMAKE_Pascal_COMPILER_LOADED 1)
+SET(CMAKE_Pascal_COMPILER_VERSION "@CMAKE_Pascal_COMPILER_VERSION@")
SET(CMAKE_Pascal_COMPILER_ENV_VAR "FPC")
--- a/cmake_modules/FindFreePascal.cmake Tue Mar 26 01:18:04 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-# - Try to find the FreePascal executable
-# Once done this will define
-#
-# FREEPASCAL_FOUND - system has Freepascal
-# FREEPASCAL_VERSION - Freepascal version
-# FREEPASCAL_EXECUTABLE - Freepascal executable
-#
-# Copyright (c) 2012, Bryan Dunsmore <dunsmoreb@gmail.com>
-# Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-find_program(FREEPASCAL_EXECUTABLE
- NAMES fpc
- PATHS /opt/local/bin /usr/local/bin /usr/bin
- )
-
-if (FREEPASCAL_EXECUTABLE)
- # check Freepascal version
- execute_process(COMMAND ${FREEPASCAL_EXECUTABLE} -iV
- OUTPUT_VARIABLE FREEPASCAL_VERSION
- ERROR_VARIABLE FREEPASCAL_VERSION_ERROR
- RESULT_VARIABLE FREEPASCAL_VERSION_RESULT
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- if(NOT ${FREEPASCAL_VERSION_RESULT} EQUAL 0)
- message(SEND_ERROR "Command \"${FREEPASCAL_EXECUTABLE} -iV\" failed with output: ${FREEPASCAL_VERSION_ERROR}")
- endif()
-endif()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(FreePascal DEFAULT_MSG FREEPASCAL_EXECUTABLE FREEPASCAL_VERSION)
-mark_as_advanced(FREEPASCAL_VERSION)
-
--- a/hedgewars/CMakeLists.txt Tue Mar 26 01:18:04 2013 +0100
+++ b/hedgewars/CMakeLists.txt Tue Mar 26 01:43:34 2013 +0100
@@ -14,11 +14,6 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-if (APPLE)
- set(required_fpc_version 2.6)
-else()
- set(required_fpc_version 2.2)
-endif()
set(engine_sources
SDLh.pas
@@ -92,12 +87,10 @@
include(${CMAKE_MODULE_PATH}/utils.cmake)
-find_package_or_fail(FreePascal)
-
-#when cmake-2.6 support is dropped, this ought to be inside FindFreePascal.cmake
-if (FREEPASCAL_VERSION VERSION_LESS required_fpc_version)
- message(FATAL_ERROR "Freepascal ${FREEPASCAL_VERSION} is too old, minimum version required is ${required_fpc_version}")
-elseif(FREEPASCAL_VERSION VERSION_GREATER 2.4)
+if (${CMAKE_Pascal_COMPILER_VERSION} VERSION_LESS 2.2 OR # older versions are just ancient
+ (${CMAKE_Pascal_COMPILER_VERSION} VERSION_LESS 2.6 AND APPLE)) # because of 64bit and opengl bindings
+ message(FATAL_ERROR "Your FreePascal installation is too old (fpc ${CMAKE_Pascal_COMPILER_VERSION})!")
+elseif(CMAKE_Pascal_COMPILER_VERSION VERSION_GREATER 2.4)
#enable INLINE only with a recent version of fpc
add_flag_prepend(CMAKE_Pascal_FLAGS_RELEASE -Si)
endif()