Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-2254

Relative paths in CMake share

    XMLWordPrintableJSON

Details

    Description

      This sequency installs well:

      cmake
      make
      make DESTDIR=/some/where install
      

      However, further use of the installation fails, because of strict dependencies on the installed paths in files like `ProtonConfig.cmake`:

      set_target_properties(Proton::core
      PROPERTIES
      IMPORTED_LOCATION "/usr/local/lib/libqpid-proton-core.so"
      IMPORTED_LOCATION_DEBUG "/usr/local/lib/libqpid-proton-core.so"
      INTERFACE_INCLUDE_DIRECTORIES "${Proton_Core_INCLUDE_DIRS}")
      

      *What would work:* First switch to the `DESTDIR`, then continue building something like Qpid Dispatch Router.

      *Solution:* Use relative directories, like in:

      # Compute the installation prefix relative to this file.
      get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
      get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
      get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
      get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
      if(_IMPORT_PREFIX STREQUAL "/")
      set(_IMPORT_PREFIX "")
      endif()
      

      *Work-around:* An unhappy quickfix is

      find /some/where -name *.cmake -exec \
           sed -i "s+/usr/+/some/where/usr/+g" {} \;
      

      Attachments

        Issue Links

          Activity

            People

              jdanek Jiri Daněk
              vanrein Rick van Rein
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0.25h Original Estimate - 0.25h
                  0.25h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h
                  4h