Permalink
Browse files

Patch from Alex Ott to allow loading of backends from default install…

… directory.
  • Loading branch information...
mloskot committed Oct 26, 2011
1 parent 0ecdbfa commit cf76df6c404314df2986130ac1de28bf97090fcb
Showing with 21 additions and 0 deletions.
  1. +5 −0 src/core/CMakeLists.txt
  2. +4 −0 src/core/backend-loader.cpp
  3. +12 −0 src/core/soci_backends_config.h.in
View
@@ -71,6 +71,11 @@ set(SOCI_CORE_TARGET ${PROJECTNAMEL}_core)
soci_target_output_name(${SOCI_CORE_TARGET} SOCI_CORE_TARGET_OUTPUT_NAME)
# Configure SOCI backend loader to also use default install directory.
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
#
@@ -17,6 +17,8 @@
#include <stdint.h>
#endif
#include "soci_backends_config.h"
using namespace soci;
using namespace soci::dynamic_backends;
@@ -102,13 +104,15 @@ std::vector<std::string> get_default_paths()
if (0 == penv)
{
paths.push_back(".");
paths.push_back(DEFAULT_BACKENDS_PATH);
return paths;
}
std::string const env = penv;
if (env.empty())
{
paths.push_back(".");
paths.push_back(DEFAULT_BACKENDS_PATH);
return paths;
}
@@ -0,0 +1,12 @@
//
// Copyright (C) 2011 Alex Ott <alexott@gmail.com>
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef SOCI_BACKENDS_CONFIG_H
#define SOCI_BACKENDS_CONFIG_H
#define DEFAULT_BACKENDS_PATH "@CMAKE_INSTALL_PREFIX@/@LIBDIR@"
#endif // SOCI_BACKENDS_CONFIG_H

0 comments on commit cf76df6

Please sign in to comment.