CMakeLists.txt
changeset 8646 e31044b7fbba
parent 8644 62756eb6fe9c
child 8650 18807b6302c8
--- a/CMakeLists.txt	Mon Mar 04 20:16:43 2013 +0400
+++ b/CMakeLists.txt	Mon Mar 04 18:27:21 2013 +0100
@@ -95,21 +95,28 @@
 if(UNIX AND NOT APPLE)
     set(target_binary_install_dir "bin")
     set(target_library_install_dir "lib")
-    set(SHAREPATH "${DATA_INSTALL_DIR}/")
+
+    string(SUBSTRING "${DATA_INSTALL_DIR}" 0 1 sharepath_start)
+    if (NOT (${sharepath_start} MATCHES "/"))
+        set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/")
+    else()
+        set(HEDGEWARS_DATADIR "${DATA_INSTALL_DIR}/")
+    endif()
+    set(HEDGEWARS_FULL_DATADIR "${HEDGEWARS_DATADIR}")
 else()
     set(target_binary_install_dir "./")
 
     if(APPLE)
+        set(target_library_install_dir "../Frameworks/")
         set(CMAKE_INSTALL_PREFIX "Hedgewars.app/Contents/MacOS/")
-        set(SHAREPATH "../Resources/")
-        set(target_library_install_dir "../Frameworks/")
-    else()
-        if(WIN32)
-            set(target_library_install_dir "./")
-            set(SHAREPATH "./")
-            set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/misc/winutils/")
-            link_directories("${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_SOURCE_DIR}/misc/winutils/bin")
-        endif(WIN32)
+        set(HEDGEWARS_DATADIR "../Resources/")
+        set(HEDGEWARS_FULL_DATADIR "/Applications/${CMAKE_INSTALL_PREFIX}/${HEDGEWARS_DATADIR}")
+    elseif(WIN32)
+        set(target_library_install_dir "./")
+        set(HEDGEWARS_DATADIR "./")
+        set(HEDGEWARS_FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/")
+        set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/misc/winutils/")
+        link_directories("${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_SOURCE_DIR}/misc/winutils/bin")
     endif()
 endif()