Hello all
I implemented small patch for SOCI that allows to use default install
location when backend loader looks for shared objects. Patch is
attached, I made it against 3.1.0
P.S. Does somebody uses github to develop soci? Will pull request more
preferable?
--
With best wishes, Alex Ott
http://alexott.net/
Tiwtter: alexott_en (English), alexott (Russian)
Skype: alex.ott
From e65a99af2a07cde52b0da2f418b1aefbd7ffd61d Mon Sep 17 00:00:00 2001
From: Alex Ott <[email protected]>
Date: Mon, 24 Oct 2011 13:10:09 +0200
Subject: [PATCH] allow to load backends from install prefix/lib
---
core/CMakeLists.txt | 6 ++++++
core/backend-loader.cpp | 4 ++++
core/soci_backends_config.h.in | 16 ++++++++++++++++
3 files changed, 26 insertions(+), 0 deletions(-)
create mode 100644 core/soci_backends_config.h.in
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index f268ec1..a5d66e9 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -71,6 +71,12 @@ set(SOCI_CORE_TARGET ${PROJECTNAMEL}_core)
soci_target_output_name(${SOCI_CORE_TARGET} SOCI_CORE_TARGET_OUTPUT_NAME)
+#
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR})
+set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR})
+
+CONFIGURE_FILE(soci_backends_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/soci_backends_config.h)
+
#
# Core shared library
#
diff --git a/core/backend-loader.cpp b/core/backend-loader.cpp
index 10bef3d..feaa977 100644
--- a/core/backend-loader.cpp
+++ b/core/backend-loader.cpp
@@ -17,6 +17,8 @@
#include <stdint.h>
#endif
+#include "soci_backends_config.h"
+
using namespace soci;
using namespace soci::dynamic_backends;
@@ -102,6 +104,7 @@ std::vector<std::string> get_default_paths()
if (0 == penv)
{
paths.push_back(".");
+ paths.push_back(DEFAULT_BACKENDS_PATH);
return paths;
}
@@ -109,6 +112,7 @@ std::vector<std::string> get_default_paths()
if (env.empty())
{
paths.push_back(".");
+ paths.push_back(DEFAULT_BACKENDS_PATH);
return paths;
}
diff --git a/core/soci_backends_config.h.in b/core/soci_backends_config.h.in
new file mode 100644
index 0000000..8ae1d5b
--- /dev/null
+++ b/core/soci_backends_config.h.in
@@ -0,0 +1,16 @@
+/* -*- mode: c++; tab-width: 4; c-basic-offset:4; indent-tabs-mode: t -*- */
+/* @doc
+ * @module <soci_backends_config.h> | <Brief description>
+ *
+ * Proprietary software, Copyright (C) 2011 McAfee, Inc.
+ * All rights reserved. No part hereof may be used or reproduced in any form
+ * without written permission by the owner. Any violation is a punishable crime.
+ *
+ */
+
+#ifndef SOCI_BACKENDS_CONFIG_H
+#define SOCI_BACKENDS_CONFIG_H
+
+#define DEFAULT_BACKENDS_PATH "@CMAKE_INSTALL_PREFIX@@LIBDIR@"
+
+#endif /* SOCI_BACKENDS_CONFIG_H */
--
1.7.5.4
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users