--- a/cmake_modules/CMakePascalInformation.cmake Wed Mar 20 18:31:13 2013 +0100
+++ b/cmake_modules/CMakePascalInformation.cmake Thu Mar 21 14:38:58 2013 +0100
@@ -134,12 +134,15 @@
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
endif(NOT EXECUTABLE_OUTPUT_PATH)
-# create an Ada shared library
-IF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY)
- SET(CMAKE_Ada_CREATE_SHARED_LIBRARY
- "<CMAKE_Ada_COMPILER> <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
- )
-ENDIF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY)
+# create a Pascal shared library
+if(NOT CMAKE_Pascal_CREATE_SHARED_LIBRARY)
+ if(WIN32)
+ set(CMAKE_Pascal_CREATE_SHARED_LIBRARY "${EXECUTABLE_OUTPUT_PATH}/ppas.bat")
+ else(WIN32)
+ set(CMAKE_Pascal_CREATE_SHARED_LIBRARY "${EXECUTABLE_OUTPUT_PATH}/ppas.sh")
+ endif(WIN32)
+# other expandable variables here are <CMAKE_Pascal_COMPILER> <CMAKE_SHARED_LIBRARY_Pascal_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG> <TARGET_SONAME> <TARGET> <OBJECTS> <LINK_LIBRARIES>
+endif(NOT CMAKE_Pascal_CREATE_SHARED_LIBRARY)
# create an Ada shared module just copy the shared library rule
IF(NOT CMAKE_Ada_CREATE_SHARED_MODULE)
@@ -183,7 +186,7 @@
else(WIN32)
set(CMAKE_Pascal_LINK_EXECUTABLE "${EXECUTABLE_OUTPUT_PATH}/ppas.sh")
endif(WIN32)
-# other expandable variables here are<CMAKE_Pascal_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE> <FLAGS> <LINK_LIBRARIES>
+# other expandable variables here are <CMAKE_Pascal_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE> <FLAGS> <LINK_LIBRARIES>
endif(NOT CMAKE_Pascal_LINK_EXECUTABLE)
if(CMAKE_Pascal_STANDARD_LIBRARIES_INIT)
--- a/hedgewars/CMakeLists.txt Wed Mar 20 18:31:13 2013 +0100
+++ b/hedgewars/CMakeLists.txt Thu Mar 21 14:38:58 2013 +0100
@@ -13,14 +13,6 @@
enable_language(Pascal)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
-#SOURCE AND PROGRAMS SECTION
-if(${BUILD_ENGINE_LIBRARY})
- set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
- set(hwengine_project hwLibrary.pas)
-else()
- set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}")
-endif()
-
if (APPLE)
set(required_fpc_version 2.6)
else()
@@ -121,7 +113,7 @@
endif()
#on OSX we need to provide the SDL_main() function when building as executable
- if(NOT ${BUILD_ENGINE_LIBRARY})
+ if(NOT BUILD_ENGINE_LIBRARY)
add_subdirectory(sdlmain)
add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
endif()
@@ -164,16 +156,7 @@
if(BUILD_ENGINE_LIBRARY)
- message(${WARNING} "Engine will be built as library (experimental)")
- add_definitions(-dHWLIBRARY)
-
- # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
- if(APPLE AND current_macosx_version VERSION_GREATER "10.5")
- add_flag_append(CMAKE_Pascal_FLAGS "-k-no_order_inits")
- endif()
- set(destination_dir ${target_library_install_dir})
else(BUILD_ENGINE_LIBRARY)
- set(destination_dir ${target_binary_install_dir})
endif(BUILD_ENGINE_LIBRARY)
@@ -186,7 +169,29 @@
endif(HAVE_IMGINIT)
add_definitions(-dDEBUGFILE)
-add_executable(hwengine ${engine_sources})
+
+#SOURCE AND PROGRAMS SECTION
+if(BUILD_ENGINE_LIBRARY)
+ message(${WARNING} "Engine will be built as library (experimental)")
+ if(APPLE AND current_macosx_version VERSION_GREATER "10.5")
+ # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
+ add_flag_append(CMAKE_Pascal_FLAGS "-k-no_order_inits")
+ endif()
+
+ #workaround for missing <TARGET> support during object generation
+ set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ set(destination_dir ${target_library_install_dir})
+ add_flags_prepend(CMAKE_Pascal_FLAGS "-o${LIBRARY_OUTPUT_PATH}/${engine_output_name}")
+
+ add_definitions(-dHWLIBRARY)
+ add_library(hwengine SHARED ${engine_sources} hwLibrary.pas)
+else()
+ # no need to change name here because target has same name
+ set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}")
+ set(destination_dir ${target_binary_install_dir})
+ add_executable(hwengine ${engine_sources})
+endif()
+
#when system Lua is not found we need to compile it before engine
if(NOT LUA_FOUND)
@@ -206,7 +211,7 @@
target_link_libraries(hwengine avwrapper)
endif()
-if(APPLE)
+if(APPLE AND NOT BUILD_ENGINE_LIBRARY)
target_link_libraries(hwengine SDLmain)
endif()