hedgewars/CMakeLists.txt
changeset 220 d79eaeaf969d
parent 196 993cf173218b
child 226 be2e08b0109f
--- a/hedgewars/CMakeLists.txt	Sun Oct 29 13:06:27 2006 +0000
+++ b/hedgewars/CMakeLists.txt	Sun Oct 29 15:30:32 2006 +0000
@@ -1,7 +1,40 @@
-set(dcc32_tryexe dcc32.exe)
+set(dcc32_tryexe dcc132.exe)
 set(fpc_tryexe fpc)
 set(hwengine_project "hwengine.dpr")
 
+set(engine_sources
+	${hwengine_project}
+	SDLh.pas
+	uAI.pas
+	uAIActions.pas
+	uAIAmmoTests.pas
+	uAIMisc.pas
+	uAIThinkStack.pas
+	uCollisions.pas
+	uConsole.pas
+	uConsts.pas
+	uGame.pas
+	uGears.pas
+	uIO.pas
+	uKeys.pas
+	uLand.pas
+	uLandGraphics.pas
+	uLandObjects.pas
+	uLandTemplates.pas
+	uLocale.pas
+	uMisc.pas
+	uRandom.pas
+	uSound.pas
+	uStore.pas
+	uTeams.pas
+	uWorld.pas
+	CCHandlers.inc
+	GSHandlers.inc
+	HHHandlers.inc
+	options.inc
+	tunsetborder.inc
+	)
+
 find_program(dcc32_executable ${dcc32_tryexe})
 find_program(fpc_executable ${fpc_tryexe})
 
@@ -16,7 +49,7 @@
 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
 if (dcc32version)
 	set(pascal_compiler ${dcc32_executable})
-	set(pascal_compiler_flags "-B" "-W" ${hwengine_project})
+	set(pascal_compiler_flags "-B" "-W" "-E${EXECUTABLE_OUTPUT_PATH}" ${hwengine_project})
 else (dcc32version)
 	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
 	if (fpc_version)
@@ -28,7 +61,7 @@
 			message("Minimum required version of FreePascal is 1.9.4")
 		else (fpc_ver LESS "010904")
 			set(pascal_compiler ${fpc_executable})
-			set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-Cs2000000" ${hwengine_project})
+			set(pascal_compiler_flags "-B" "-Sd" "-Xs" "-OG" "-O2" "-FE${EXECUTABLE_OUTPUT_PATH}" "-Cs2000000" ${hwengine_project})
 		endif (fpc_ver LESS "010904")
 	endif (fpc_version)
 endif (dcc32version)
@@ -37,6 +70,13 @@
 	message(FATAL_ERROR "No Pascal compiler found!")
 endif (NOT pascal_compiler)
 
-add_custom_target(hwengine ALL COMMAND "${pascal_compiler}" ${pascal_compiler_flags})
+add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
+                  COMMAND "${pascal_compiler}" 
+                  ARGS ${pascal_compiler_flags}
+                  MAIN_DEPENDENCY ${hwengine_project}
+                  DEPENDS ${engine_sources}
+                  )
+                   
+add_custom_target(hwengine ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
 
-install(PROGRAMS "hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
+install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)