cmake_modules/paths.cmake
changeset 9198 48b92ff6238f
parent 9190 4fc0e95e7b64
child 9200 37c37026f7ec
equal deleted inserted replaced
9196:89d98f970de9 9198:48b92ff6238f
    27         set(HEDGEWARS_DATADIR "./")
    27         set(HEDGEWARS_DATADIR "./")
    28         set(HEDGEWARS_FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/")
    28         set(HEDGEWARS_FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/")
    29         link_directories("${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_SOURCE_DIR}/misc/winutils/bin")
    29         link_directories("${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_SOURCE_DIR}/misc/winutils/bin")
    30     endif()
    30     endif()
    31 endif()
    31 endif()
       
    32 
       
    33 
       
    34 #RPATH SETTINGS
       
    35 #necessary for dynamic libraries on UNIX, ignored elsewhere
       
    36 
       
    37 #use, i.e. don't skip the full RPATH for the build tree
       
    38 set(CMAKE_SKIP_BUILD_RPATH FALSE)
       
    39 set(CMAKE_SKIP_INSTALL_RPATH FALSE)
       
    40 
       
    41 #it's safe to use our RPATH because it is relative
       
    42 set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
       
    43 
       
    44 #paths where to find libraries (final slash not optional):
       
    45 # - the first is relative to the executable
       
    46 # - the second is the same directory of the executable (so it runs in bin/)
       
    47 # - the third one is the full path of the system dir
       
    48 #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
       
    49 set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
       
    50 set(CMAKE_INSTALL_RPATH_ESCAPED "$$ORIGIN/../${target_library_install_dir}/:$$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
       
    51 
       
    52 if(UNIX AND NOT APPLE)
       
    53     list(APPEND pascal_flags "-k-rpath" "-k'${CMAKE_INSTALL_RPATH_ESCAPED}'")
       
    54     list(APPEND haskell_flags "-optl" "-Wl,-rpath,'${CMAKE_INSTALL_RPATH_ESCAPED}'")
       
    55 endif()
       
    56 
       
    57 #add the automatically determined parts of the RPATH
       
    58 #which point to directories outside the build tree to the install RPATH
       
    59 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
       
    60 
       
    61