[ 
https://issues.apache.org/jira/browse/PROTON-2254?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jiri Daněk updated PROTON-2254:
-------------------------------
    Description: 
This sequency installs well:

{noformat}
cmake
make
make DESTDIR=/some/where install
{noformat}

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

{noformat}
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}")
{noformat}

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

**Solution:** Use relative directories, like in:

{noformat}
# 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()
{noformat}

**Work-around:** An unhappy quickfix is

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

  was:
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" {} \;}}


> Relative paths in CMake share
> -----------------------------
>
>                 Key: PROTON-2254
>                 URL: https://issues.apache.org/jira/browse/PROTON-2254
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: proton-c
>    Affects Versions: proton-c-0.31.0
>         Environment: Debian Linux; build Proton then Dispatch into each their 
> own `DESTDIR`.  This is done by our "layered build" system, 
> https://gitlab.com/arpa2/mkhere/-/blob/master/qpid_proton.sh and 
> https://gitlab.com/arpa2/mkhere/-/blob/master/qpid_dispatch.sh
>            Reporter: Rick van Rein
>            Priority: Minor
>              Labels: cmake, install, proton
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> This sequency installs well:
> {noformat}
> cmake
> make
> make DESTDIR=/some/where install
> {noformat}
> However, further use of the installation fails, because of strict 
> dependencies on the *installed* paths in files like `ProtonConfig.cmake`:
> {noformat}
> 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}")
> {noformat}
> **What would work:** First switch to the `DESTDIR`, then continue building 
> something like Qpid Dispatch Router.
> **Solution:** Use relative directories, like in:
> {noformat}
> # 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()
> {noformat}
> **Work-around:** An unhappy quickfix is
> {noformat}
> find /some/where -name *.cmake -exec \
>      sed -i "s+/usr/+/some/where/usr/+g" {} \;
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to