This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new 5edfbd6 PROTON-2450 Generate correct relocatable pc files (#335)
5edfbd6 is described below
commit 5edfbd6842fbfcc54c793ee4dd59c7e83c2c2f44
Author: Jiri Daněk <[email protected]>
AuthorDate: Wed Nov 24 17:06:41 2021 +0100
PROTON-2450 Generate correct relocatable pc files (#335)
---
CMakeLists.txt | 14 +++++------
c/CMakeLists.txt | 1 +
.../examples/Makefile.pkgconfig | 28 ++++++++++------------
c/src/ProtonConfig.cmake.in | 6 ++---
c/src/libqpid-proton-core.pc.in | 8 +++----
c/src/libqpid-proton-proactor.pc.in | 9 +++----
c/src/libqpid-proton.pc.in | 8 +++----
cpp/CMakeLists.txt | 1 +
cpp/ProtonCppConfig.cmake.in | 2 +-
.../Makefile.pkgconfig} | 28 ++++++++++------------
cpp/libqpid-proton-cpp.pc.in | 9 +++----
11 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0eb169a..f82e756 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}" "${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}")
## LANGUAGE BINDINGS
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index a6cdda3..4401234 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -635,6 +635,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/cpp/ProtonCppConfig.cmake.in b/c/examples/Makefile.pkgconfig
similarity index 61%
copy from cpp/ProtonCppConfig.cmake.in
copy to c/examples/Makefile.pkgconfig
index e869170..6ad7af3 100644
--- a/cpp/ProtonCppConfig.cmake.in
+++ b/c/examples/Makefile.pkgconfig
@@ -17,22 +17,20 @@
# under the License.
#
-# Name: Proton
-# Description: Qpid Proton C library
-# Version: @PN_VERSION@
-# URL: http://qpid.apache.org/proton/
+# This Makefile demonstrates the use of pkgconfig to compile
+# programs that make use of Qpid Proton C
-@PACKAGE_INIT@
-if (NOT ProtonCpp_USE_STATIC_LIBS)
- include("${CMAKE_CURRENT_LIST_DIR}/ProtonCppTargets.cmake")
-else()
- include("${CMAKE_CURRENT_LIST_DIR}/ProtonCppTargetsStatic.cmake")
-endif()
+CFLAGS=-g -Wall -Wextra $(shell pkg-config --cflags libqpid-proton-core
--cflags libqpid-proton-proactor)
+LDFLAGS=$(shell pkg-config --libs libqpid-proton-core --libs
libqpid-proton-proactor)
-set (ProtonCpp_VERSION @PN_VERSION@)
+SOURCES=$(wildcard *.c)
+EXECUTABLES=$(patsubst %.c,%,$(SOURCES))
-set (ProtonCpp_INCLUDE_DIRS @INCLUDEDIR@)
-set (ProtonCpp_LIBRARIES Proton::cpp)
-set (ProtonCpp_FOUND True)
+all: $(EXECUTABLES)
-check_required_components(ProtonCpp)
+% : %.c
+ $(CC) -o $@ $(CFLAGS) $(LDFLAGS) -lpthread $<
+
+.PHONY: clean
+clean:
+ rm -f $(EXECUTABLES)
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..c1d3fc7 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}/@LIBDIR@
+includedir=${prefix}/@INCLUDEDIR@
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..4d33948 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}/@LIBDIR@
+includedir=${prefix}/@INCLUDEDIR@
Name: Proton Proactor
Description: Qpid Proton C proactive IO library
@@ -28,3 +28,4 @@ Version: @PN_VERSION@
URL: http://qpid.apache.org/proton/
Libs: -L${libdir} -lqpid-proton-proactor
Cflags: -I${includedir}
+Requires: libqpid-proton-core
diff --git a/c/src/libqpid-proton.pc.in b/c/src/libqpid-proton.pc.in
index a045c3f..8a63124 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}/@LIBDIR@
+includedir=${prefix}/@INCLUDEDIR@
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/ProtonCppConfig.cmake.in b/cpp/examples/Makefile.pkgconfig
similarity index 61%
copy from cpp/ProtonCppConfig.cmake.in
copy to cpp/examples/Makefile.pkgconfig
index e869170..2752a8a 100644
--- a/cpp/ProtonCppConfig.cmake.in
+++ b/cpp/examples/Makefile.pkgconfig
@@ -17,22 +17,20 @@
# under the License.
#
-# Name: Proton
-# Description: Qpid Proton C library
-# Version: @PN_VERSION@
-# URL: http://qpid.apache.org/proton/
+# This Makefile demonstrates the use of pkgconfig to compile
+# programs that make use of Qpid Proton Cpp
-@PACKAGE_INIT@
-if (NOT ProtonCpp_USE_STATIC_LIBS)
- include("${CMAKE_CURRENT_LIST_DIR}/ProtonCppTargets.cmake")
-else()
- include("${CMAKE_CURRENT_LIST_DIR}/ProtonCppTargetsStatic.cmake")
-endif()
+CFLAGS=-g -Wall -Wextra $(shell pkg-config --cflags libqpid-proton-cpp)
+LDFLAGS=$(shell pkg-config --libs libqpid-proton-cpp)
-set (ProtonCpp_VERSION @PN_VERSION@)
+SOURCES=$(wildcard *.cpp)
+EXECUTABLES=$(patsubst %.cpp,%,$(SOURCES))
-set (ProtonCpp_INCLUDE_DIRS @INCLUDEDIR@)
-set (ProtonCpp_LIBRARIES Proton::cpp)
-set (ProtonCpp_FOUND True)
+all: $(EXECUTABLES)
-check_required_components(ProtonCpp)
+% : %.cpp
+ $(CXX) -o $@ $(CFLAGS) $(LDFLAGS) -lpthread $<
+
+.PHONY: clean
+clean:
+ rm -f $(EXECUTABLES)
diff --git a/cpp/libqpid-proton-cpp.pc.in b/cpp/libqpid-proton-cpp.pc.in
index 4b556f4..98012c8 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}/@LIBDIR@
+includedir=${prefix}/@INCLUDEDIR@
Name: Proton C++
Description: Qpid Proton C++ library
@@ -28,3 +28,4 @@ Version: @PN_VERSION@
URL: http://qpid.apache.org/proton/
Libs: -L${libdir} -lqpid-proton-cpp
Cflags: -I${includedir}
+Requires: libqpid-proton-core, libqpid-proton-proactor
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]