have fpc work in the right directory instead of passing the full path of the main module (avoids having full paths in debug build backtraces for the first module only)
authorkoda
Sat, 09 Mar 2013 00:57:09 +0100
changeset 8702 a28966180a29
parent 8701 b99c49f78f56
child 8703 a1e6dc8a267d
have fpc work in the right directory instead of passing the full path of the main module (avoids having full paths in debug build backtraces for the first module only)
hedgewars/CMakeLists.txt
--- a/hedgewars/CMakeLists.txt	Sat Mar 09 00:43:26 2013 +0100
+++ b/hedgewars/CMakeLists.txt	Sat Mar 09 00:57:09 2013 +0100
@@ -17,15 +17,15 @@
 endif()
 
 
-configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
+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 ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas)
+    set(hwengine_project hwLibrary.pas)
 else()
     set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}")
-    set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
+    set(hwengine_project hwengine.pas)
 endif()
 
 if (APPLE)
@@ -180,7 +180,7 @@
     else()
         set(SAFE_BUILD_TOOL ${CMAKE_BUILD_TOOL})
     endif()
-    add_custom_target(ENGINECLEAN COMMAND ${SAFE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
+    add_custom_target(ENGINECLEAN COMMAND ${SAFE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
 endif()
 
 
@@ -210,8 +210,8 @@
     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}"
         COMMAND "${FREEPASCAL_EXECUTABLE}"
         ARGS ${fpc_flags} -o${engine_output_name}
-        MAIN_DEPENDENCY ${hwengine_project}
         DEPENDS ${engine_sources}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         )
 else()
     #these are the dependencies for building a universal binary on Mac OS X
@@ -220,8 +220,8 @@
         add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
             COMMAND "${FREEPASCAL_EXECUTABLE}"
             ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch}
-            MAIN_DEPENDENCY ${hwengine_project}
             DEPENDS ${engine_sources}
+            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
             )
         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
         add_custom_command(TARGET hwengine.${build_arch} POST_BUILD