Fix: T42553 Linux cmake install now also without absolute path's
authorMartijn Berger <martijn.berger@gmail.com>
Tue, 11 Nov 2014 20:44:26 +0000 (21:44 +0100)
committerMartijn Berger <martijn.berger@gmail.com>
Tue, 11 Nov 2014 20:44:26 +0000 (21:44 +0100)
OS X cmake probably needs more checking.

CMakeLists.txt
source/creator/CMakeLists.txt

index 260d797531d8a01934235d4d25358fec896deaea..f11afab87a647275bbb1c9a19970bc4368791fea 100644 (file)
@@ -368,16 +368,19 @@ if(MSVC)
        set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
 endif()
 
+
 # By default we want to install to the directory we are compiling our executables
 # unless specified otherwise, which we currently do not allow
+IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 if(MSVC)
-       set(BLENDER_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
+       set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "default install path" FORCE )
 elseif(APPLE)
-       set(BLENDER_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
+       set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "default install path" FORCE )
 else()
-       set(BLENDER_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH})
+       set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH} CACHE PATH "default install path" FORCE )
+endif()
 endif()
-set(CMAKE_INSTALL_PREFIX ${BLENDER_INSTALL_PREFIX} CACHE INTERNAL "")
+
 
 
 # Apple
@@ -1692,6 +1695,12 @@ elseif(WIN32)
                endif()
        endif()
 
+       set(CPACK_PACKAGE_INSTALL_DIRECTORY "Blender Foundation/Blender")
+       set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Blender Foundation/Blender")
+       set(CPACK_WIX_LICENSE_RTF ${CMAKE_SOURCE_DIR}/release/text/GPL-license.rtf)
+       set(CPACK_WIX_PRODUCT_ICON ${CMAKE_SOURCE_DIR}/source/icons/winblender.ico)
+       set(CPACK_WIX_UPGRADE_GUID "B767E4FD-7DE7-4094-B051-3AE62E13A17A")
+
 elseif(APPLE)
 
        if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STRGREATER "10.5")
index 95c165522005e6a4c7c98b64f72f8fdbf65996ee..b0055c0a4f4ae41e44d8fdcae6b3032942d44863 100644 (file)
@@ -257,12 +257,12 @@ endif()
 
 if(UNIX AND NOT APPLE)
        if(WITH_INSTALL_PORTABLE)
-               set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION})
+               set(TARGETDIR_VER ${BLENDER_VERSION})
        else()
                if(WITH_PYTHON_MODULE)
                        set(TARGETDIR_VER ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${BLENDER_VERSION})
                else()
-                       set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
+                       set(TARGETDIR_VER share/blender/${BLENDER_VERSION})
                endif()
        endif()
 
@@ -391,15 +391,11 @@ endif()
 if(UNIX AND NOT APPLE)
 
        if(NOT WITH_PYTHON_MODULE)
-               install(
-                       CODE
-                       "
-                       execute_process(COMMAND
-                                                       ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
-                                                       ${CMAKE_INSTALL_PREFIX}/blender
-                                                       ${CMAKE_INSTALL_PREFIX}/blender.1)
-                       "
-               )
+           add_custom_target(blender_man_page ALL
+                             COMMAND ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py ${EXECUTABLE_OUTPUT_PATH}/blender ${CMAKE_CURRENT_BINARY_DIR}/blender.1)
+
+           add_dependencies(blender_man_page blender)
+
        endif()
 
        # there are a few differences between portable and system install
@@ -408,27 +404,31 @@ if(UNIX AND NOT APPLE)
                        # pass
                else()
                        install(
-                               FILES ${CMAKE_INSTALL_PREFIX}/blender.1
-                               DESTINATION ${CMAKE_INSTALL_PREFIX}
+                               FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
+                               DESTINATION "."
                        )
                endif()
+               install(
+                       TARGETS blender
+                       DESTINATION "."
+               )
 
                install(
                        FILES
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}
+                       DESTINATION "."
                )
 
                install(
                        PROGRAMS
                        ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}
+                       DESTINATION "."
                )
 
                install(
                        FILES ${BLENDER_TEXT_FILES}
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}
+                       DESTINATION "."
                )
 
        else()
@@ -436,33 +436,32 @@ if(UNIX AND NOT APPLE)
                if(WITH_PYTHON_MODULE)
                        install(
                                TARGETS blender
-                               LIBRARY
-                               DESTINATION ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages
+                               LIBRARY DESTINATION ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages
                        )
                else()
                        install(
-                               PROGRAMS ${CMAKE_INSTALL_PREFIX}/blender
-                               DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                               TARGETS blender
+                               DESTINATION bin
                        )
                        # manpage only with 'blender' binary
                        install(
-                               FILES ${CMAKE_INSTALL_PREFIX}/blender.1
-                               DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
+                               FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
+                               DESTINATION share/man/man1
                        )
                endif()
 
 
                if(WITH_GAMEENGINE AND WITH_PLAYER)
                        install(
-                               PROGRAMS ${CMAKE_INSTALL_PREFIX}/blenderplayer
-                               DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                               TARGETS blenderplayer
+                               DESTINATION bin
                        )
                endif()
 
                # misc files
                install(
                        FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
+                       DESTINATION share/applications
                )
                install(
                        DIRECTORY
@@ -472,20 +471,20 @@ if(UNIX AND NOT APPLE)
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor
+                       DESTINATION share/icons/hicolor
                        PATTERN "*.svg" EXCLUDE
                )
                install(
                        FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps
+                       DESTINATION share/icons/hicolor/scalable/apps
                )
                install(
                        PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                       DESTINATION bin
                )
                install(
                        FILES ${BLENDER_TEXT_FILES}
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
+                       DESTINATION share/doc/blender
                )
        endif()
 
@@ -805,7 +804,9 @@ elseif(APPLE)
        set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blender.app)
 
        # setup Info.plist
-       execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
+       execute_process(COMMAND date "+%Y-%m-%d"
+                       OUTPUT_VARIABLE BLENDER_DATE
+                       OUTPUT_STRIP_TRAILING_WHITESPACE)
 
        set_target_properties(blender PROPERTIES
                MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist