fix cmakefiles to work with mercurial
authorkoda
Thu, 17 Jun 2010 20:37:49 +0200
changeset 3515 3e8635f43972
parent 3514 59dbd31e9953
child 3516 a8c673657b79
child 3517 b7a4220dca26
fix cmakefiles to work with mercurial
CMakeLists.txt
QTfrontend/pages.cpp
hedgewars/CMakeLists.txt
--- a/CMakeLists.txt	Thu Jun 17 20:30:39 2010 +0200
+++ b/CMakeLists.txt	Thu Jun 17 20:37:49 2010 +0200
@@ -1,26 +1,31 @@
 project(hedgewars)
 
 cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
+cmake_policy(SET CMP0003 NEW)
 
-IF(COMMAND cmake_policy)
-	cmake_policy(SET CMP0003 NEW)
-ENDIF(COMMAND cmake_policy)
+IF(POLICY CMP0012)
+	cmake_policy(SET CMP0012 NEW)
+ENDIF()
 
 #detect subversion revision (if present)
 set(version_suffix "-dev") #UNSET THIS VARIABLE AT RELEASE TIME
 IF(version_suffix MATCHES "-dev")
 	set(HW_DEV true)
-	IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn) 
-		FIND_PACKAGE(Subversion)
-		IF(Subversion_FOUND)
-			Subversion_WC_INFO(${CMAKE_HOME_DIRECTORY} Project)
-			MESSAGE(STATUS "Builing revision ${Project_WC_REVISION}")
-			set(version_suffix ".${Project_WC_REVISION}")
-			#truncate to numbers only - trying to fix a problem described in http://www.hedgewars.org/node/2019
-			STRING(REGEX REPLACE "^\\.(\\d+)" ".\\1" version_suffix ${version_suffix})
-			# screw whole suffix if there's no number
-			STRING(REGEX REPLACE "^\\.([a-z]+.*)" "-dev" version_suffix ${version_suffix})
-		ENDIF(Subversion_FOUND)
+	IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.hg) 
+		FIND_PROGRAM(HGCOMMAND hg)
+		IF(HGCOMMAND)
+			exec_program(${HGCOMMAND} 
+				     ARGS identify ${CMAKE_CURRENT_SOURCE_DIR}
+				     OUTPUT_VARIABLE version_suffix
+				     )
+			STRING(REGEX REPLACE "(.*) +.*" "\\1" version_suffix ${version_suffix})
+			MESSAGE(STATUS "Builing revision ${version_suffix}")
+			set(version_suffix ".${version_suffix}")
+#			#truncate to numbers only - trying to fix a problem described in http://www.hedgewars.org/node/2019
+#			STRING(REGEX REPLACE "^\\.(\\d+)" ".\\1" version_suffix ${version_suffix})
+#			# screw whole suffix if there's no number
+#			STRING(REGEX REPLACE "^\\.([a-z]+.*)" "-dev" version_suffix ${version_suffix})
+		ENDIF()
 	ENDIF()
 ELSE()
 	set(HW_DEV false)
@@ -177,13 +182,14 @@
 	set(HAVE_NETSERVER false)
 endif(WITH_SERVER)
 
-
-add_subdirectory(bin)
-add_subdirectory(QTfrontend)
 add_subdirectory(hedgewars)
-add_subdirectory(share)
-add_subdirectory(tools)
-add_subdirectory(misc/liblua)
+if(NOT BUILD_ENGINE_LIBRARY)
+	add_subdirectory(bin)
+	add_subdirectory(QTfrontend)
+	add_subdirectory(share)
+	add_subdirectory(tools)
+	add_subdirectory(misc/liblua)
+endif()
 
 # CPack vars
 
--- a/QTfrontend/pages.cpp	Thu Jun 17 20:30:39 2010 +0200
+++ b/QTfrontend/pages.cpp	Thu Jun 17 20:37:49 2010 +0200
@@ -122,7 +122,7 @@
     
 
     if(isDevBuild)
-        mainNote->setText(QLabel::tr("This SVN build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
+        mainNote->setText(QLabel::tr("This HG build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
     else
         mainNote->setText(QLabel::tr("Tip: ") + Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]);
 
--- a/hedgewars/CMakeLists.txt	Thu Jun 17 20:30:39 2010 +0200
+++ b/hedgewars/CMakeLists.txt	Thu Jun 17 20:37:49 2010 +0200
@@ -82,7 +82,7 @@
 	message(STATUS "Engine will be built as library (experimental)")
 	set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas)
 	set(engine_sources ${hwengine_project} PascalExports.pas ${engine_sources})
-	set(pascal_compiler_flags_cmn "-dHWLIBRARY" "-k-no_order_inits" ${pascal_compiler_flags_cmn})
+	set(pascal_compiler_flags_cmn "-dHWLIBRARY" "-k-no_order_inits" "-fPIC" ${pascal_compiler_flags_cmn})
 endif(BUILD_ENGINE_LIBRARY)