diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e03e1538feabaffae2b35801f87052be99146ff..c74c2ffbbd16b56d5126453a025b2a9f49e6c427 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,9 +38,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
 # Build options
-set(FETCH_LIBHDBPP_TAG "master" CACHE STRING "Libhdbpp branch/tag to clone 'master'")
-option(FETCH_LIBHDBPP "Download and build using a local copy of libhdb++" ON)
-option(FETCH_LIBHDBPP_TAG "When FETCH_LIBHDBPP is enabled, this is the tag fetch ('master')")
 option(BUILD_UNIT_TESTS "Build unit tests" OFF)
 option(BUILD_BENCHMARK_TESTS "Build benchmarking tests (Forces RELEASE build)" OFF)
 option(ENABLE_CLANG "Enable clang code and layout analysis" OFF)
@@ -59,9 +56,6 @@ include(GNUInstallDirs)
 
 message(STATUS "Searching for libraries...")
 
-# Variable to contain a list of all the libs we depend on
-set(TDB_LIBRARIES) 
-
 # allow pkg-config to search the CMAKE_PREFIX_PATH 
 set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
 list(APPEND CMAKE_PREFIX_PATH "/usr")
@@ -77,11 +71,33 @@ find_package(Tango)
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 
-# Attempt to find the various libraries the project is dependent on
-if(TDB_LIBRARIES)
-    find_libraries(LIBRARIES ${TDB_LIBRARIES} SEARCH_PATHS ${LIBRARY_PATHS})
-    set(TDB_FOUND_LIBRARIES ${FOUND_LIBRARIES})
-endif(TDB_LIBRARIES)
+# Find the libhdbpp headers
+find_package(libhdbpp)
+
+# If not installed then get them
+if(NOT libhdbpp_FOUND)
+    include(FetchContent)
+
+    FetchContent_Declare(
+      libhdbpp
+      GIT_REPOSITORY https://github.com/tango-controls-hdbpp/libhdbpp.git
+      GIT_TAG        project-build
+    )
+
+    FetchContent_GetProperties(libhdbpp)
+    if(NOT libhdbpp_POPULATED)
+        FetchContent_Populate(libhdbpp)
+        add_subdirectory(${libhdbpp_SOURCE_DIR} ${libhdbpp_BINARY_DIR})
+    endif()
+
+    add_library(libhdbpp::libhdbpp_headers ALIAS libhdbpp_headers)
+
+    get_target_property(TEST libhdbpp::libhdbpp_headers IMPORTED)
+    get_target_property(TEST1 libhdbpp::libhdbpp_headers INTERFACE_INCLUDE_DIRECTORIES)
+    message(STATUS ${TEST})
+    message(STATUS ${TEST1})
+
+endif(NOT libhdbpp_FOUND)
 
 # Thirdparty Integration -----------------------------------
 
@@ -139,8 +155,8 @@ add_subdirectory(src)
 add_library(libhdbpp_timescale_shared_library SHARED ${SRC_FILES})
 
 target_link_libraries(libhdbpp_timescale_shared_library 
-    PUBLIC ${TDB_FOUND_LIBRARIES} pqxx_static spdlog::spdlog_header_only Threads::Threads
-    PRIVATE TangoInterfaceLibrary)
+    PUBLIC libhdbpp::libhdbpp_headers
+    PRIVATE Threads::Threads pqxx_static spdlog::spdlog_header_only TangoInterfaceLibrary)
 
 target_include_directories(libhdbpp_timescale_shared_library 
     PUBLIC
@@ -173,7 +189,8 @@ target_compile_options(libhdbpp_timescale_shared_library
 add_library(libhdbpp_timescale_static_library STATIC EXCLUDE_FROM_ALL ${SRC_FILES})
 
 target_link_libraries(libhdbpp_timescale_static_library 
-    PUBLIC ${TDB_FOUND_LIBRARIES} pqxx_static spdlog Threads::Threads
+    INTERFACE libhdbpp::libhdbpp_headers
+    PUBLIC pqxx_static spdlog Threads::Threads
     PRIVATE TangoInterfaceLibrary)
 
 target_include_directories(libhdbpp_timescale_static_library 
@@ -196,17 +213,57 @@ target_compile_options(libhdbpp_timescale_static_library
     PRIVATE "$<$<CONFIG:DEBUG>:-g>")
 
 # Install Config -----------------------------------
+include(CMakePackageConfigHelpers)
+
 install(
     TARGETS libhdbpp_timescale_shared_library
+    EXPORT libhdbpp-timescaleTargets
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
+set(ConfigPackageLocation lib/cmake/libhdbpp-timescale)
+set(Namespace libhdbpp::)
+
+write_basic_package_version_file(
+  "${CMAKE_CURRENT_BINARY_DIR}/libhdbpp-timescale/libhdbpp-timescaleConfigVersion.cmake"
+  VERSION ${VERSION_STRING}
+  COMPATIBILITY AnyNewerVersion
+)
+
+export(EXPORT libhdbpp-timescaleTargets
+  FILE
+    "${CMAKE_CURRENT_BINARY_DIR}/libhdbpp-timescale/libhdbpp-timescaleTargets.cmake"
+  NAMESPACE ${Namespace}
+)
+
+
+# generate the config file that is includes the exports
+configure_package_config_file(cmake/libhdbpp-timescaleConfig.cmake.in
+  "${CMAKE_CURRENT_BINARY_DIR}/libhdbpp-timescale/libhdbpp-timescaleConfig.cmake"
+  INSTALL_DESTINATION
+    ${ConfigPackageLocation}
+  NO_SET_AND_CHECK_MACRO
+  NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+
+install(EXPORT libhdbpp-timescaleTargets
+  FILE
+    libhdbpp-timescaleTargets.cmake
+  NAMESPACE
+    ${Namespace}
+  DESTINATION
+    ${ConfigPackageLocation}
+)
+
 install(
-    DIRECTORY ${PROJECT_SOURCE_DIR}/include/
-    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-    FILES_MATCHING
-    PATTERN HdbppTimescaleDb.hpp)
+  FILES
+    "${CMAKE_CURRENT_BINARY_DIR}/libhdbpp-timescale/libhdbpp-timescaleConfig.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/libhdbpp-timescale/libhdbpp-timescaleConfigVersion.cmake"
+  DESTINATION
+    ${ConfigPackageLocation}
+)
+
 
 # Tests -----------------------------------
 if(BUILD_UNIT_TESTS)
diff --git a/benchmark/QueryBuilderTests.cpp b/benchmark/QueryBuilderTests.cpp
index 24970008c1e8e951ea57d525574bc4a97c5535cb..a9e31a7c3d2771a0ed350d7fc7221b2535faa73e 100644
--- a/benchmark/QueryBuilderTests.cpp
+++ b/benchmark/QueryBuilderTests.cpp
@@ -16,17 +16,17 @@
 
    You should have received a copy of the Lesser GNU General Public License
    along with libhdb++timescale.  If not, see <http://www.gnu.org/licenses/>. */
-   
+
 #include "QueryBuilder.hpp"
 #include <benchmark/benchmark.h>
 
 //=============================================================================
 //=============================================================================
-void bmAllocateQueryBuilder(benchmark::State& state) 
+void bmAllocateQueryBuilder(benchmark::State &state)
 {
     // Test - Testing the time it takes to allocate a QueryBuilder, mainly for future test
     // reference
-    hdbpp_internal::LogConfigurator::initLogging();
+    hdbpp_internal::LogConfigurator::initLogging("test");
 
     for (auto _ : state)
         hdbpp_internal::pqxx_conn::QueryBuilder query_builder;
@@ -36,10 +36,10 @@ BENCHMARK(bmAllocateQueryBuilder);
 
 //=============================================================================
 //=============================================================================
-void bmTraitsComparator(benchmark::State& state) 
+void bmTraitsComparator(benchmark::State &state)
 {
     // TEST - Test the AttributeTraits comparator used in the cache inside QueryBuilder,
-    // the test is against a full map with every possible tango traits combination 
+    // the test is against a full map with every possible tango traits combination
     std::map<hdbpp_internal::AttributeTraits, std::string> trait_cache;
 
     vector<Tango::CmdArgType> types {Tango::DEV_DOUBLE,
@@ -84,22 +84,22 @@ BENCHMARK(bmTraitsComparator);
 
 //=============================================================================
 //=============================================================================
-static void writeTypeArgs(benchmark::internal::Benchmark* b) 
+static void writeTypeArgs(benchmark::internal::Benchmark *b)
 {
     vector<Tango::AttrWriteType> write_types {Tango::READ, Tango::WRITE, Tango::READ_WRITE, Tango::READ_WITH_WRITE};
 
-    for (auto & write_type : write_types)
+    for (auto &write_type : write_types)
         b->Args({static_cast<int>(write_type)});
 }
 
 //=============================================================================
 //=============================================================================
 template<typename T>
-void bmStoreDataEventQueryNoCache(benchmark::State& state) 
+void bmStoreDataEventQueryNoCache(benchmark::State &state)
 {
     // TEST - Testing how long it takes to build an Insert Data Event query with
     // an empty cache (this forces the full string to be built)
-    hdbpp_internal::LogConfigurator::initLogging();
+    hdbpp_internal::LogConfigurator::initLogging("test");
 
     hdbpp_internal::AttributeTraits traits 
         {static_cast<Tango::AttrWriteType>(state.range(0)), Tango::SCALAR, Tango::DEV_DOUBLE};
@@ -115,11 +115,11 @@ void bmStoreDataEventQueryNoCache(benchmark::State& state)
 //=============================================================================
 //=============================================================================
 template<typename T>
-void bmStoreDataEventQueryCache(benchmark::State& state) 
+void bmStoreDataEventQueryCache(benchmark::State &state)
 {
     // TEST - Testing the full lookup for an Insert Data QueryEvent query when the cache
-    // map is fully populated 
-    hdbpp_internal::LogConfigurator::initLogging();
+    // map is fully populated
+    hdbpp_internal::LogConfigurator::initLogging("test");
 
     hdbpp_internal::AttributeTraits traits 
         {static_cast<Tango::AttrWriteType>(state.range(0)), Tango::SCALAR, Tango::DEV_DOUBLE};
@@ -147,7 +147,7 @@ void bmStoreDataEventQueryCache(benchmark::State& state)
     for (auto &type : types)
         for (auto &format : format_types)
             for (auto &write : write_types)
-                query_builder.storeDataEventStatement<T>(hdbpp_internal::AttributeTraits{write, format, type});
+                query_builder.storeDataEventStatement<T>(hdbpp_internal::AttributeTraits {write, format, type});
 
     for (auto _ : state)
         query_builder.storeDataEventStatement<T>(traits);
diff --git a/cmake/libhdbpp-timescaleConfig.cmake.in b/cmake/libhdbpp-timescaleConfig.cmake.in
new file mode 100644
index 0000000000000000000000000000000000000000..39bc5447ad04b68bf3afd74f0a1f3c607f7b665d
--- /dev/null
+++ b/cmake/libhdbpp-timescaleConfig.cmake.in
@@ -0,0 +1,7 @@
+@PACKAGE_INIT@
+
+find_package(libhdbpp)
+
+include("${CMAKE_CURRENT_LIST_DIR}/libhdbpp-timescaleTargets.cmake")
+
+set(BACKEND_TARGET libhdbpp::libhdbpp_timescale_shared_library)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ba862873111265df81514d0ac46648b078c7d487..cef634ea5cc40c8ff5d5306a10485c382f173d8b 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,17 +9,9 @@ set(LOCAL_SRC_FILES
     ${CMAKE_CURRENT_SOURCE_DIR}/LibUtils.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/DbConnection.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/QueryBuilder.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/PqxxExtension.cpp)
-
-if(NOT BYPASS_LIBHDBPP)
-    set(LOCAL_SRC_FILES ${LOCAL_SRC_FILES}
-        ${CMAKE_CURRENT_SOURCE_DIR}/HdbppTimescaleDb.cpp)
-endif()
-
-if(BYPASS_LIBHDBPP)
-    set(LOCAL_SRC_FILES ${LOCAL_SRC_FILES}
-        ${CMAKE_CURRENT_SOURCE_DIR}/HdbClient.cpp)
-endif()
+    ${CMAKE_CURRENT_SOURCE_DIR}/PqxxExtension.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/HdbppTimescaleDb.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/HdbClient.cpp)
 
 set(SRC_FILES 
     ${SRC_FILES} 
diff --git a/src/HdbClient.cpp b/src/HdbClient.cpp
index 23455698c582be4db9a16c785640f14f03653f74..bf728e71e1a69fbc54569164b56d0ea11dc95d29 100644
--- a/src/HdbClient.cpp
+++ b/src/HdbClient.cpp
@@ -19,7 +19,7 @@
 
 #include "HdbppTimescaleDbApi.hpp"
 
-#include <hdb++/HdbClient.h>
+#include "HdbClient.h"
 
 using namespace std;
 
diff --git a/src/HdbClient.h b/src/HdbClient.h
new file mode 100644
index 0000000000000000000000000000000000000000..78445f8953f2294733fd7cc40b015a6921d64f21
--- /dev/null
+++ b/src/HdbClient.h
@@ -0,0 +1,72 @@
+/* Copyright (C) : 2014-2019
+   European Synchrotron Radiation Facility
+   BP 220, Grenoble 38043, FRANCE
+
+   This file is part of libhdb++timescale.
+
+   libhdb++timescale is free software: you can redistribute it and/or modify
+   it under the terms of the Lesser GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   libhdb++timescale is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser
+   GNU General Public License for more details.
+
+   You should have received a copy of the Lesser GNU General Public License
+   along with libhdb++timescale.  If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _HDBPP_TIMESCALE_CLIENT_HPP
+#define _HDBPP_TIMESCALE_CLIENT_HPP
+
+#include "hdb++/AbstractDB.h"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace hdbpp
+{
+class HdbClient : public AbstractDB
+{
+public:
+    HdbClient(const string &id, const std::vector<std::string> &configuration);
+    virtual ~HdbClient() {}
+
+    // Inserts an attribute archive event for the EventData into the database. If the attribute
+    // does not exist in the database, then an exception will be raised. If the attr_value
+    // field of the data parameter if empty, then the attribute is in an error state
+    // and the error message will be archived.
+    void insert_event(Tango::EventData *event, const HdbEventDataType &data_type) override;
+
+    // Insert multiple attribute archive events. Any attributes that do not exist will
+    // cause an exception. On failure the fall back is to insert events individually
+    void insert_events(std::vector<std::tuple<Tango::EventData *, HdbEventDataType>> events) override;
+
+    // Inserts the attribute configuration data (Tango Attribute Configuration event data)
+    // into the database. The attribute must be configured to be stored in HDB++,
+    // otherwise an exception will be thrown.
+    void insert_param_event(Tango::AttrConfEventData *data, const HdbEventDataType &data_type) override;
+
+    // Add an attribute to the database. Trying to add an attribute that already exists will
+    // cause an exception
+    void add_attribute(const std::string &name, int type, int format, int write_type) override;
+
+    // Update the attribute ttl. The attribute must have been configured to be stored in
+    // HDB++, otherwise an exception is raised
+    void update_ttl(const std::string &name, unsigned int ttl) override;
+
+    // Inserts a history event for the attribute name passed to the function. The attribute
+    // must have been configured to be stored in HDB++, otherwise an exception is raised.
+    void insert_history_event(const std::string &name, unsigned char event) override;
+
+    // Check what hdbpp features this library supports.
+    bool supported(HdbppFeatures feature) override;
+
+private:
+    std::unique_ptr<AbstractDB> _db;
+};
+
+} // namespace hdbpp
+#endif // _HDBPP_TIMESCALE_CLIENT_HPP
diff --git a/src/HdbppTimescaleDb.cpp b/src/HdbppTimescaleDb.cpp
index b0f3c239fd33d87b8ba3ee25d0d531e88dd174cf..9e7bc89e08e8399358d9df502baaab694c102a24 100644
--- a/src/HdbppTimescaleDb.cpp
+++ b/src/HdbppTimescaleDb.cpp
@@ -17,7 +17,7 @@
    You should have received a copy of the Lesser GNU General Public License
    along with libhdb++timescale.  If not, see <http://www.gnu.org/licenses/>. */
 
-#include "hdb++/HdbppTimescaleDb.hpp"
+#include "HdbppTimescaleDb.hpp"
 
 #include "HdbppTimescaleDbApi.hpp"
 
diff --git a/include/hdb++/HdbppTimescaleDb.hpp b/src/HdbppTimescaleDb.hpp
similarity index 100%
rename from include/hdb++/HdbppTimescaleDb.hpp
rename to src/HdbppTimescaleDb.hpp
diff --git a/test/main.cpp b/test/main.cpp
index b1a62c68e36b1f776b4856ace0050f6f671b3283..85da4ef4c68ed3b1566504d6a93856f0ab0185bf 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -24,12 +24,12 @@
 
 int main(int argc, char *argv[])
 {
-    hdbpp_internal::LogConfigurator::initLogging();
-    //hdbpp_internal::LogConfigurator::initConsoleLogging();
+    hdbpp_internal::LogConfigurator::initLogging("tests");
+    //hdbpp_internal::LogConfigurator::initConsoleLogging("tests");
     hdbpp_internal::LogConfigurator::setLoggingLevel(spdlog::level::err);
 
     int result = Catch::Session().run(argc, argv);
 
-    hdbpp_internal::LogConfigurator::shutdownLogging();
+    hdbpp_internal::LogConfigurator::shutdownLogging("tests");
     return result;
 }