Fix installation in cmake project files
authorPerttu Ahola <celeron55@gmail.com>
Sun, 18 Mar 2012 14:30:02 +0000 (16:30 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 18 Mar 2012 14:30:02 +0000 (16:30 +0200)
CMakeLists.txt
src/CMakeLists.txt

index d2530de6147fa7f0a8420c6d5aafa7d359137fdf..1eb5c2f1312952d2d8d6883298334b9b49acf882 100644 (file)
@@ -49,29 +49,38 @@ find_package(Irrlicht)
 #
 
 if(WIN32)
-       set(DATADIR "data")
+       set(SHAREDIR "share")
        set(BINDIR "bin")
        set(DOCDIR "doc")
-       set(EXAMPLE_CONF_DIR ".")
+       set(EXAMPLE_CONF_DIR "user")
 elseif(APPLE)
        # random placeholders
-       set(DATADIR "share/${PROJECT_NAME}")
+       set(SHAREDIR "share/${PROJECT_NAME}")
        set(BINDIR "bin")
        set(DOCDIR "share/doc/${PROJECT_NAME}")
-       set(EXAMPLE_CONF_DIR ".")
+       set(EXAMPLE_CONF_DIR ${DOCDIR})
 elseif(UNIX) # Linux, BSD etc
-       set(DATADIR "share/${PROJECT_NAME}")
-       set(BINDIR "bin")
-       set(DOCDIR "share/doc/${PROJECT_NAME}")
-       set(MANDIR "share/man")
-       set(EXAMPLE_CONF_DIR "share/doc/${PROJECT_NAME}")
-       set(XDG_APPS_DIR "share/applications")
-       set(ICONDIR "share/icons")
+       if(RUN_IN_PLACE)
+               set(SHAREDIR "share")
+               set(BINDIR "bin")
+               set(DOCDIR "doc")
+               set(MANDIR "share/unix/man")
+               set(EXAMPLE_CONF_DIR ${DOCDIR})
+               set(XDG_APPS_DIR "share/unix/applications")
+               set(ICONDIR "share/unix/icons")
+       else()
+               set(SHAREDIR "share/${PROJECT_NAME}")
+               set(BINDIR "bin")
+               set(DOCDIR "share/doc/${PROJECT_NAME}")
+               set(MANDIR "share/man")
+               set(EXAMPLE_CONF_DIR ${DOCDIR})
+               set(XDG_APPS_DIR "share/applications")
+               set(ICONDIR "share/icons")
+       endif()
 endif()
 
 install(FILES "README.txt" DESTINATION "${DOCDIR}")
-install(FILES "doc/changelog.txt" DESTINATION "${DOCDIR}")
-install(FILES "minetest.conf.example" DESTINATION "${DOCDIR}")
+install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
 
 if(UNIX)
        install(FILES "doc/minetest.6" "doc/minetestserver.6" DESTINATION "${MANDIR}/man6")
index d3d9d64dc561d10168e5ab90b5a74ee92c7f70be..448f2f6b8128dd67c29ee626a9fc0a73a6567859 100644 (file)
@@ -310,18 +310,10 @@ endif()
 # Installation
 #
 
-# Example configuration file
-# NOTE: Install is handled elsewhere
-#install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../minetest.conf.example" DESTINATION ${EXAMPLE_CONF_DIR})
-
 if(BUILD_CLIENT)
        install(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
 
-       #file(GLOB images "${CMAKE_CURRENT_SOURCE_DIR}/../data/textures/*.png")
-       #install(FILES ${images} DESTINATION ${DATADIR}/textures)
-       #file(GLOB datasubstuff "${CMAKE_CURRENT_SOURCE_DIR}/../data/*")
-       #install(DIRECTORY "${datasubstuff}" DESTINATION ${DATADIR})
-       install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../data/" DESTINATION ${DATADIR})
+       install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../share/" DESTINATION ${SHAREDIR})
 
        if(USE_GETTEXT)
                foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})