[
https://issues.apache.org/jira/browse/PROTON-2254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17445849#comment-17445849
]
ASF GitHub Bot commented on PROTON-2254:
----------------------------------------
jiridanek commented on a change in pull request #335:
URL: https://github.com/apache/qpid-proton/pull/335#discussion_r752133906
##########
File path: CMakeLists.txt
##########
@@ -276,18 +276,18 @@ set (MAN_INSTALL_DIR share/man CACHE PATH "Manpage
directory")
mark_as_advanced (INCLUDE_INSTALL_DIR LIB_INSTALL_DIR SYSCONF_INSTALL_DIR
SHARE_INSTALL_DIR MAN_INSTALL_DIR)
-# ${PACKAGE_PREFIX_DIR} is expanded from @PACKAGE_INIT@
-# by configure_package_config_file(), and available in ProtonConfig.cmake
-macro (pn_relative_install_dir NAME VALUE)
+# Sets variable NAME to contain relative path from ROOT to VALUE
+# if VALUE is already relative, it does nothing
+macro (pn_relative_install_dir NAME ROOT VALUE)
if (IS_ABSOLUTE ${VALUE})
- message(WARNING "Build was given an absolute path '${VALUE}'. As a result,
`make DESTDIR=... install` will not work.")
- set (${NAME} "${VALUE}")
+ file(RELATIVE_PATH "${NAME}" "${ROOT}" "${VALUE}")
else ()
- set (${NAME} "\${PACKAGE_PREFIX_DIR}/${VALUE}")
+ set (${NAME} "${VALUE}")
endif ()
endmacro ()
-pn_relative_install_dir (INCLUDEDIR ${INCLUDE_INSTALL_DIR})
+pn_relative_install_dir (INCLUDEDIR "${CMAKE_INSTALL_PREFIX}"
"${INCLUDE_INSTALL_DIR}")
+pn_relative_install_dir (LIBDIR "${CMAKE_INSTALL_PREFIX}" "${LIB_INSTALL_DIR}")
Review comment:
When they are being set in the RPM build, they are set in the form of an
absolute path (that is not logic inherent in RPM build, it is what _our_ rpm
build for Fedora/CentOS/RHEL decides to do). If we don't want to have absolute
paths in pc files, then the paths have to be relativized.
`pn_relative_install_dir` passes relative paths unchanged, so when what's
given is already relative, it won't be touched.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> Relative paths in CMake share
> -----------------------------
>
> Key: PROTON-2254
> URL: https://issues.apache.org/jira/browse/PROTON-2254
> Project: Qpid Proton
> Issue Type: Improvement
> Components: build, cpp-binding, 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
> Assignee: Jiri Daněk
> Priority: Minor
> Labels: cmake, install, proton
> Fix For: proton-c-0.36.0
>
> Original Estimate: 0.25h
> Time Spent: 4h
> Remaining Estimate: 0h
>
> 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.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]