hedgewars/CMakeLists.txt
changeset 7031 d5ea24399a48
parent 7029 efbe6400fc24
child 7109 af3a43a46f21
--- a/hedgewars/CMakeLists.txt	Mon May 07 11:59:09 2012 +0200
+++ b/hedgewars/CMakeLists.txt	Mon May 07 14:53:08 2012 +0200
@@ -3,7 +3,6 @@
 find_package(SDL_net)
 find_package(SDL_ttf)
 find_package(SDL_mixer)
-find_package(Lua)
 
 include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake)
 
@@ -188,7 +187,7 @@
             COMMAND "${pascal_compiler}"
             ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch}
             MAIN_DEPENDENCY ${hwengine_project}
-            DEPENDS ${engine_sources} SDLmain lua
+            DEPENDS ${engine_sources} SDLmain
             )
         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
     endforeach()
@@ -202,10 +201,19 @@
 
 
 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
-IF(NOT APPLE)
+
+#when system Lua is not found we need to compile it before engine
+if(NOT ${LUA_FOUND})
+    add_dependencies(${engine_output_name} lua)
+endif()
+
+#this command is a workaround to some inlining issues present in older
+# FreePascal versions and fixed in 2.6, That version is mandatory on OSX,
+# hence the command is not needed there
+if(NOT APPLE)
     add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
     add_dependencies(${engine_output_name} ENGINECLEAN)
-ENDIF()
+endif()
 
 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})