cmake_modules/paths.cmake
branchsdl2transition
changeset 11362 ed5a6478e710
parent 11329 ac6715709812
child 14253 084af6d2685f
equal deleted inserted replaced
11361:31570b766315 11362:ed5a6478e710
    12 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${LIBRARY_OUTPUT_PATH})
    12 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${LIBRARY_OUTPUT_PATH})
    13 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${LIBRARY_OUTPUT_PATH})
    13 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${LIBRARY_OUTPUT_PATH})
    14 
    14 
    15 #resource paths
    15 #resource paths
    16 if(UNIX AND NOT APPLE)
    16 if(UNIX AND NOT APPLE)
    17     set(target_binary_install_dir "bin")
    17     set(target_binary_install_dir "bin" CACHE PATH "install dest for binaries")
    18     set(target_library_install_dir "lib")
    18     set(target_library_install_dir "lib${LIB_SUFFIX}" CACHE PATH "install dest for libs")
    19 
    19 
    20     string(SUBSTRING "${DATA_INSTALL_DIR}" 0 1 sharepath_start)
    20     string(SUBSTRING "${DATA_INSTALL_DIR}" 0 1 sharepath_start)
    21     if (NOT (${sharepath_start} MATCHES "/"))
    21     if(${sharepath_start} MATCHES "/")
       
    22         set(HEDGEWARS_DATADIR "${DATA_INSTALL_DIR}/")
       
    23     else()
    22         set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/")
    24         set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/")
    23     else()
       
    24         set(HEDGEWARS_DATADIR "${DATA_INSTALL_DIR}/")
       
    25     endif()
    25     endif()
    26     set(HEDGEWARS_FULL_DATADIR "${HEDGEWARS_DATADIR}")
    26     set(HEDGEWARS_FULL_DATADIR "${HEDGEWARS_DATADIR}")
    27 else()
    27 else()
    28     set(target_binary_install_dir "./")
    28     set(target_binary_install_dir "./")
    29 
    29 
    53 
    53 
    54 #add the automatically determined parts of the RPATH
    54 #add the automatically determined parts of the RPATH
    55 #which point to directories outside the build tree to the install RPATH
    55 #which point to directories outside the build tree to the install RPATH
    56 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
    56 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
    57 
    57 
    58 #paths where to find libraries (final slash not optional):
    58 if(APPLE)
    59 # - the first is relative to the executable
    59     #@rpath mangling
    60 # - the second is the same directory of the executable (so it runs in bin/)
    60     set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
    61 # - the third one is the full path of the system dir
    61     #install_name_tool for libraries
    62 #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
    62     set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
    63 set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
    63 else(APPLE AND NOT (${CMAKE_INSTALL_PREFIX} MATCHES "/usr"))
    64 
    64     #paths where to find libraries (final slash not optional):
    65 
    65     # - the first is relative to the executable
    66 #install_name_tool magic for OS X
    66     # - the second is the same directory of the executable (so it runs in bin/)
    67 set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
    67     # - the third one is the full path of the system dir
    68 
    68     #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
       
    69     #skip this if the install prefix is the standard one
       
    70     set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
       
    71 endif(APPLE)