move DATA_INSTALL_DIR to the configurable options section
authorkoda
Thu, 27 Dec 2012 15:32:48 +0100 (2012-12-27)
changeset 8333 416cb5e5a405
parent 8331 217c3fd72a2d
child 8335 bc948db1273a
move DATA_INSTALL_DIR to the configurable options section
CMakeLists.txt
QTfrontend/CMakeLists.txt
--- a/CMakeLists.txt	Thu Dec 27 13:24:57 2012 +0100
+++ b/CMakeLists.txt	Thu Dec 27 15:32:48 2012 +0100
@@ -23,9 +23,11 @@
 option(ANDROID "Enable Android build [default: off]" OFF)
 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF)
 option(MINIMAL_FLAGS "Respect system flags as much as possible [default: off]" OFF)
-set(FPFLAGS "" CACHE STRING "Additional Freepascal flags" FORCE)
-set(GHFLAGS "" CACHE STRING "Additional Haskell flags" FORCE)
-
+set(FPFLAGS "" CACHE STRING "Additional Freepascal flags")
+set(GHFLAGS "" CACHE STRING "Additional Haskell flags")
+if(UNIX AND NOT APPLE)
+    set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path")
+endif()
 
 #detect Mercurial revision (if present)
 if(NOT NOREVISION)
@@ -72,11 +74,7 @@
 if(UNIX AND NOT APPLE)
     set(target_binary_install_dir "bin")
     set(target_library_install_dir "lib")
-    if(DEFINED DATA_INSTALL_DIR)
-        set(SHAREPATH "${DATA_INSTALL_DIR}/")
-    else()
-        set(SHAREPATH "share/hedgewars/")
-    endif()
+    set(SHAREPATH "${DATA_INSTALL_DIR}/")
 else()
     set(target_binary_install_dir "./")
 
--- a/QTfrontend/CMakeLists.txt	Thu Dec 27 13:24:57 2012 +0100
+++ b/QTfrontend/CMakeLists.txt	Thu Dec 27 15:32:48 2012 +0100
@@ -41,11 +41,12 @@
     include_directories("/usr/local/include")
 endif(UNIX)
 
-#directory for resources, relative to the one above on certain platforms/configurations
-if(DEFINED DATA_INSTALL_DIR OR WIN32 OR APPLE)
+#directory for resources, relative to bindir unless absolute path is used
+string(FIND "${SHAREPATH}" "/" sharepath_is_absolute)
+if(${sharepath_is_absolute} EQUAL 0)
     set(HEDGEWARS_DATADIR ${SHAREPATH})
 else()
-    set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/${SHAREPATH}/)
+    set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/${SHAREPATH})
 endif()
 
 #only the cocoa version of qt supports building 64 bit apps