[CMake] still having rpath problems on osxZ

Boudewijn Rempt boud at valdyas.org
Thu Dec 31 08:46:15 UTC 2015


Oh, and for reference, it's this code block:

################# RPATH handling ##################################

if(NOT KDE_SKIP_RPATH_SETTINGS)

    # Set the default RPATH to point to useful locations, namely where the
    # libraries will be installed and the linker search path

    if(NOT LIB_INSTALL_DIR)
       message(FATAL_ERROR "LIB_INSTALL_DIR not set. This is necessary for using the RPATH settings.")
    endif()

    set(_abs_LIB_INSTALL_DIR "${LIB_INSTALL_DIR}")
    if (NOT IS_ABSOLUTE "${_abs_LIB_INSTALL_DIR}")
       set(_abs_LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
    endif()

    if (UNIX)
       # for mac os: add install name dir in addition
       # check: is the rpath stuff below really required on mac os? at least it seems so to use a stock qt from qt.io
       if (APPLE)
          set(CMAKE_INSTALL_NAME_DIR ${_abs_LIB_INSTALL_DIR})
       endif ()

       # add our LIB_INSTALL_DIR to the RPATH (but only when it is not one of
       # the standard system link directories - such as /usr/lib on UNIX)
       list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${_abs_LIB_INSTALL_DIR}" _isSystemLibDir)
       list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES      "${_abs_LIB_INSTALL_DIR}" _isSystemCxxLibDir)
       list(FIND CMAKE_C_IMPLICIT_LINK_DIRECTORIES        "${_abs_LIB_INSTALL_DIR}" _isSystemCLibDir)
       if("${_isSystemLibDir}" STREQUAL "-1"  AND  "${_isSystemCxxLibDir}" STREQUAL "-1"  AND  "${_isSystemCLibDir}" STREQUAL "-1")
          set(CMAKE_INSTALL_RPATH "${_abs_LIB_INSTALL_DIR}")
       endif()

       # Append directories in the linker search path (but outside the project)
       set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
    endif (UNIX)

endif()


-- 
Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org


More information about the Kde-buildsystem mailing list