cmake_modules/paths.cmake
branchwebgl
changeset 9950 2759212a27de
parent 9521 8054d9d775fd
parent 9870 acf1ccf06b2d
child 10069 c4ad9c76b542
equal deleted inserted replaced
9521:8054d9d775fd 9950:2759212a27de
    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" 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 (NOT (${sharepath_start} MATCHES "/"))
    22         set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/")
    22         set(HEDGEWARS_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/")
    23     else()
    23     else()
    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)
    64 #\\\\ is just \\ which escapes '\' in the final script; same for $$ which escapes '$' in cmake
    64     #paths where to find libraries (final slash not optional):
    65 set(CMAKE_INSTALL_RPATH_ESCAPED "\\\\$$ORIGIN/../${target_library_install_dir}/:\\\\$$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
    65     # - the first is relative to the executable
    66 
    66     # - the second is the same directory of the executable (so it runs in bin/)
    67 if(UNIX AND NOT APPLE)
    67     # - the third one is the full path of the system dir
    68     if(CMAKE_COMPILER_IS_GNUCC)
    68     #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
    69        #make sure $ORIGIN is respected
    69     set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
    70         add_linker_flag("-zorigin")
    70 endif(APPLE)
    71     endif()
       
    72     #apply RPATH settings to pascal executables
       
    73     add_flag_append(CMAKE_Pascal_FLAGS "-k-rpath -k'${CMAKE_INSTALL_RPATH_ESCAPED}'")
       
    74     #until we link with external things there is no need to set rpath on haskell
       
    75     #list(APPEND haskell_flags "-optl" "-Wl,-rpath,'${CMAKE_INSTALL_RPATH_ESCAPED}'")
       
    76 endif()
       
    77 
       
    78 #add the automatically determined parts of the RPATH
       
    79 #which point to directories outside the build tree to the install RPATH
       
    80 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
       
    81 
       
    82 
       
    83 #install_name_tool magic for OS X
       
    84 set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
       
    85