cmake_modules/paths.cmake
changeset 9339 14f5f3a1e2f7
parent 9313 62032a4cd00b
child 9521 8054d9d775fd
child 9856 891eb7fcc26c
child 9861 2b4f9e1496c6
equal deleted inserted replaced
9337:c9d4daae1dee 9339:14f5f3a1e2f7
    49 set(CMAKE_SKIP_INSTALL_RPATH FALSE)
    49 set(CMAKE_SKIP_INSTALL_RPATH FALSE)
    50 
    50 
    51 #it's safe to use our RPATH because it is relative
    51 #it's safe to use our RPATH because it is relative
    52 set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
    52 set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
    53 
    53 
       
    54 #add the automatically determined parts of the RPATH
       
    55 #which point to directories outside the build tree to the install RPATH
       
    56 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
       
    57 
    54 #paths where to find libraries (final slash not optional):
    58 #paths where to find libraries (final slash not optional):
    55 # - the first is relative to the executable
    59 # - the first is relative to the executable
    56 # - the second is the same directory of the executable (so it runs in bin/)
    60 # - the second is the same directory of the executable (so it runs in bin/)
    57 # - the third one is the full path of the system dir
    61 # - the third one is the full path of the system dir
    58 #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
    62 #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
    59 set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
    63 set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
    60 #\\\\ is just \\ which escapes '\' in the final script; same for $$ which escapes '$' in cmake
       
    61 set(CMAKE_INSTALL_RPATH_ESCAPED "\\\\$$ORIGIN/../${target_library_install_dir}/:\\\\$$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
       
    62 
       
    63 if(UNIX AND NOT APPLE)
       
    64     if(CMAKE_COMPILER_IS_GNUCC)
       
    65        #make sure $ORIGIN is respected
       
    66         add_linker_flag("-zorigin")
       
    67     endif()
       
    68     #apply RPATH settings to pascal executables
       
    69     add_flag_append(CMAKE_Pascal_FLAGS "-k-rpath -k'${CMAKE_INSTALL_RPATH_ESCAPED}'")
       
    70     #until we link with external things there is no need to set rpath on haskell
       
    71     #list(APPEND haskell_flags "-optl" "-Wl,-rpath,'${CMAKE_INSTALL_RPATH_ESCAPED}'")
       
    72 endif()
       
    73 
       
    74 #add the automatically determined parts of the RPATH
       
    75 #which point to directories outside the build tree to the install RPATH
       
    76 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
       
    77 
    64 
    78 
    65 
    79 #install_name_tool magic for OS X
    66 #install_name_tool magic for OS X
    80 set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
    67 set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
    81 
    68