You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2021/09/20 10:31:06 UTC

[qpid-proton] 01/01: PROTON-2254 Generate correct relocatable pc files

This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch jd_PROTON-2433_interface_library_dirs
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit cce81221dd4c12f003856a957a66a4cab5789129
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Mon Sep 20 12:30:39 2021 +0200

    PROTON-2254 Generate correct relocatable pc files
---
 CMakeLists.txt                      | 14 +++++++-------
 c/CMakeLists.txt                    |  1 +
 c/src/ProtonConfig.cmake.in         |  6 +++---
 c/src/libqpid-proton-core.pc.in     |  8 ++++----
 c/src/libqpid-proton-proactor.pc.in |  8 ++++----
 c/src/libqpid-proton.pc.in          |  8 ++++----
 cpp/CMakeLists.txt                  |  1 +
 cpp/ProtonCppConfig.cmake.in        |  2 +-
 cpp/libqpid-proton-cpp.pc.in        |  8 ++++----
 9 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0eb169a..1b5c794 100644
--- a/CMakeLists.txt
+++ b/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}" "${CMAKE_INSTALL_PREFIX}" "${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}")
 
 ## LANGUAGE BINDINGS
 
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index f505ff8..7066409 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -597,6 +597,7 @@ include(WriteBasicConfigVersionFile)
 configure_package_config_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/src/ProtonConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfig.cmake
+  PATH_VARS INCLUDE_INSTALL_DIR
   INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/Proton)
 write_basic_config_version_file(
   ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake
diff --git a/c/src/ProtonConfig.cmake.in b/c/src/ProtonConfig.cmake.in
index 24c2e13..f7b8abb 100644
--- a/c/src/ProtonConfig.cmake.in
+++ b/c/src/ProtonConfig.cmake.in
@@ -52,17 +52,17 @@ if (Proton_USE_STATIC_LIBS)
     set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_OLD})
 endif()
 
-set (Proton_INCLUDE_DIRS @INCLUDEDIR@)
+set (Proton_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@)
 set (Proton_LIBRARIES Proton::qpid-proton)
 set (Proton_FOUND True)
 
-set (Proton_Core_INCLUDE_DIRS @INCLUDEDIR@)
+set (Proton_Core_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@)
 set (Proton_Core_LIBRARIES Proton::core)
 set (Proton_Core_FOUND True)
 
 set (HAS_PROACTOR @HAS_PROACTOR@)
 if (HAS_PROACTOR)
-  set (Proton_Proactor_INCLUDE_DIRS @INCLUDEDIR@)
+  set (Proton_Proactor_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@)
   set (Proton_Proactor_LIBRARIES Proton::proactor)
   set (Proton_Proactor_FOUND True)
 endif()
diff --git a/c/src/libqpid-proton-core.pc.in b/c/src/libqpid-proton-core.pc.in
index ff99108..48cd02e 100644
--- a/c/src/libqpid-proton-core.pc.in
+++ b/c/src/libqpid-proton-core.pc.in
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${prefix}/@INCLUDEDIR@
+includedir=${prefix}/@LIBDIR@
 
 Name: Proton Core
 Description: Qpid Proton C core protocol library
diff --git a/c/src/libqpid-proton-proactor.pc.in b/c/src/libqpid-proton-proactor.pc.in
index c9f7ddb..a6539ca 100644
--- a/c/src/libqpid-proton-proactor.pc.in
+++ b/c/src/libqpid-proton-proactor.pc.in
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${prefix}/@INCLUDEDIR@
+includedir=${prefix}/@LIBDIR@
 
 Name: Proton Proactor
 Description: Qpid Proton C proactive IO library
diff --git a/c/src/libqpid-proton.pc.in b/c/src/libqpid-proton.pc.in
index a045c3f..121ebc6 100644
--- a/c/src/libqpid-proton.pc.in
+++ b/c/src/libqpid-proton.pc.in
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${prefix}/@INCLUDEDIR@
+includedir=${prefix}/@LIBDIR@
 
 Name: Proton
 Description: Qpid Proton C library
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 0376461..03fe80a 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -202,6 +202,7 @@ include(WriteBasicConfigVersionFile)
 configure_package_config_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ProtonCppConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake
+  PATH_VARS INCLUDE_INSTALL_DIR
   INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
 write_basic_config_version_file(
   ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake
diff --git a/cpp/ProtonCppConfig.cmake.in b/cpp/ProtonCppConfig.cmake.in
index e869170..74ddfaa 100644
--- a/cpp/ProtonCppConfig.cmake.in
+++ b/cpp/ProtonCppConfig.cmake.in
@@ -31,7 +31,7 @@ endif()
 
 set (ProtonCpp_VERSION @PN_VERSION@)
 
-set (ProtonCpp_INCLUDE_DIRS @INCLUDEDIR@)
+set (ProtonCpp_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@)
 set (ProtonCpp_LIBRARIES Proton::cpp)
 set (ProtonCpp_FOUND True)
 
diff --git a/cpp/libqpid-proton-cpp.pc.in b/cpp/libqpid-proton-cpp.pc.in
index 4b556f4..0218109 100644
--- a/cpp/libqpid-proton-cpp.pc.in
+++ b/cpp/libqpid-proton-cpp.pc.in
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${prefix}/@INCLUDEDIR@
+includedir=${prefix}/@LIBDIR@
 
 Name: Proton C++
 Description: Qpid Proton C++ library

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org