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

astitcher 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 bee4fea2c PROTON-2617: Header file version.h exposes the install prefix
bee4fea2c is described below

commit bee4fea2cdcb14ed0055a77dcce4fd5f9718e3ce
Author: Andrew Stitcher <[email protected]>
AuthorDate: Tue Oct 4 14:54:14 2022 -0400

    PROTON-2617: Header file version.h exposes the install prefix
---
 c/include/proton/version.h.in | 2 --
 cpp/CMakeLists.txt            | 5 ++++-
 cpp/src/connect_config.cpp    | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/c/include/proton/version.h.in b/c/include/proton/version.h.in
index 13ee4119c..133b0bbf8 100644
--- a/c/include/proton/version.h.in
+++ b/c/include/proton/version.h.in
@@ -26,6 +26,4 @@
 #define PN_VERSION_MINOR @PN_VERSION_MINOR@
 #define PN_VERSION_POINT @PN_VERSION_POINT@
 
-#define PN_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
-
 #endif /* version.h */
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 03fe80a60..4b006aed0 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -108,10 +108,13 @@ set(qpid-proton-cpp-source
   )
 
 add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source})
+target_compile_definitions(qpid-proton-cpp
+  PRIVATE "PN_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
+
 if(BUILD_STATIC_LIBS)
   add_library(qpid-proton-cpp-static STATIC ${qpid-proton-cpp-source})
   target_compile_definitions(qpid-proton-cpp-static
-    PRIVATE PROTON_DECLARE_STATIC
+    PRIVATE PROTON_DECLARE_STATIC "PN_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
     PUBLIC PN_CPP_DECLARE_STATIC)
   set_target_properties (
     qpid-proton-cpp-static
diff --git a/cpp/src/connect_config.cpp b/cpp/src/connect_config.cpp
index 5901c9503..46b982be0 100644
--- a/cpp/src/connect_config.cpp
+++ b/cpp/src/connect_config.cpp
@@ -25,7 +25,6 @@
 #include <proton/connection_options.hpp>
 #include <proton/error.hpp>
 #include <proton/ssl.hpp>
-#include <proton/version.h>
 
 #include <json/value.h>
 #include <json/reader.h>
@@ -89,6 +88,7 @@ static const string HOME("HOME");
 static const string ENV_VAR("MESSAGING_CONNECT_FILE");
 static const string FILE_NAME("connect.json");
 static const string HOME_FILE_NAME("/.config/messaging/" + FILE_NAME);
+static const string INSTALL_PREFIX(QUOTE(PN_INSTALL_PREFIX));
 static const string ETC_FILE_NAME("/etc/messaging/" + FILE_NAME);
 
 void parse_sasl(Value root, connection_options& opts) {
@@ -201,7 +201,7 @@ bool config_file(std::ifstream& f, std::string& name) {
     // $HOME/.config/messaging/FILE_NAME
     if (home) path.push_back(home + HOME_FILE_NAME);
     // INSTALL_PREFIX/etc/messaging/FILE_NAME
-    if (PN_INSTALL_PREFIX && *PN_INSTALL_PREFIX) 
path.push_back(PN_INSTALL_PREFIX + ETC_FILE_NAME);
+    if (!INSTALL_PREFIX.empty()) path.push_back(INSTALL_PREFIX + 
ETC_FILE_NAME);
 
     for (unsigned i = 0; i < path.size(); ++i) {
         name = path[i];


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

Reply via email to