Commit e36633b8 authored by Ronan's avatar Ronan

Merge branch 'feature/use-cpack-to-generate-rpm' into 'bc'

chore(build): use CPack to generate spec file

See merge request !1
parents d1fc622b 38b3a44a
......@@ -5,7 +5,6 @@ tags
tmp
# Build directories
/*build*
/*site*
# Files generated by CMake
......
......@@ -10,9 +10,10 @@
###############################################################################
# General settings
###############################################################################
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
project(SOCI)
cmake_minimum_required(VERSION 3.0)
project(SOCI VERSION 4.0.0 LANGUAGES CXX)
###############################################################################
# Build features and variants
......@@ -23,7 +24,6 @@ option(SOCI_STATIC "Enable build of static libraries" ON)
option(SOCI_TESTS "Enable build of collection of SOCI tests" ON)
option(SOCI_ASAN "Enable address sanitizer on GCC v4.8+/Clang v 3.1+" OFF)
###############################################################################
# SOCI CMake modules
###############################################################################
......@@ -41,6 +41,7 @@ colormsg(_HIBLUE_ "Configuring SOCI:")
###############################################################################
# SOCI version information
###############################################################################
include(SociVersion)
soci_version()
......@@ -76,49 +77,47 @@ set(SOCI_CORE_DEPS_LIBS)
include(SociDependencies)
get_property(SOCI_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY INCLUDE_DIRECTORIES)
get_property(SOCI_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
if(Threads_FOUND)
list(APPEND SOCI_CORE_DEPS_LIBS ${CMAKE_THREAD_LIBS_INIT})
list(APPEND SOCI_CORE_DEPS_LIBS ${CMAKE_THREAD_LIBS_INIT})
else()
message(FATAL_ERROR "No thread library found")
message(FATAL_ERROR "No thread library found")
endif()
if(NOT MSVC)
set(DL_FIND_QUIETLY TRUE)
find_package(DL)
if(DL_FOUND)
list(APPEND SOCI_CORE_DEPS_LIBS ${DL_LIBRARY})
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES ${DL_INCLUDE_DIR})
add_definitions(-DHAVE_DL=1)
endif()
set(DL_FIND_QUIETLY TRUE)
find_package(DL)
if(DL_FOUND)
list(APPEND SOCI_CORE_DEPS_LIBS ${DL_LIBRARY})
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES ${DL_INCLUDE_DIR})
add_definitions(-DHAVE_DL=1)
endif()
endif()
if(Boost_FOUND)
get_property(SOCI_COMPILE_DEFINITIONS
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY COMPILE_DEFINITIONS)
set(SOCI_HAVE_BOOST ON)
get_property(SOCI_COMPILE_DEFINITIONS
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY COMPILE_DEFINITIONS
)
list(APPEND SOCI_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB")
set(SOCI_HAVE_BOOST ON)
if(Boost_DATE_TIME_FOUND)
list(APPEND SOCI_CORE_DEPS_LIBS ${Boost_DATE_TIME_LIBRARY})
set(SOCI_HAVE_BOOST_DATE_TIME ON)
endif()
list(APPEND SOCI_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB")
list(APPEND SOCI_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
list(APPEND SOCI_CORE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
if(Boost_DATE_TIME_FOUND)
list(APPEND SOCI_CORE_DEPS_LIBS ${Boost_DATE_TIME_LIBRARY})
set(SOCI_HAVE_BOOST_DATE_TIME ON)
endif()
set_directory_properties(PROPERTY COMPILE_DEFINITIONS "${SOCI_COMPILE_DEFINITIONS}")
list(APPEND SOCI_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
list(APPEND SOCI_CORE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
set_property(DIRECTORY ${SOCI_SOURCE_DIR}
PROPERTY COMPILE_DEFINITIONS "${SOCI_COMPILE_DEFINITIONS}")
set_directory_properties(PROPERTY COMPILE_DEFINITIONS "${SOCI_COMPILE_DEFINITIONS}")
set_property(DIRECTORY ${SOCI_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS "${SOCI_COMPILE_DEFINITIONS}")
else()
set(SOCI_HAVE_BOOST OFF)
set(SOCI_HAVE_BOOST_DATE_TIME OFF)
set(SOCI_HAVE_BOOST OFF)
set(SOCI_HAVE_BOOST_DATE_TIME OFF)
endif()
set(SOCI_HAVE_BOOST ${SOCI_HAVE_BOOST} CACHE INTERNAL "Boost library")
......@@ -127,15 +126,16 @@ set(SOCI_HAVE_BOOST_DATE_TIME ${SOCI_HAVE_BOOST_DATE_TIME} CACHE INTERNAL "Boost
list(APPEND SOCI_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY
INCLUDE_DIRECTORIES ${SOCI_INCLUDE_DIRS})
PROPERTY
INCLUDE_DIRECTORIES ${SOCI_INCLUDE_DIRS}
)
###############################################################################
# Installation
###############################################################################
if(NOT DEFINED SOCI_LIBDIR)
set(SOCI_LIBDIR ${CMAKE_INSTALL_LIBDIR})
set(SOCI_LIBDIR ${CMAKE_INSTALL_LIBDIR})
endif()
set(BINDIR "bin" CACHE PATH "The directory to install binaries into.")
......@@ -146,39 +146,39 @@ set(INCLUDEDIR "include" CACHE PATH "The directory to install includes into.")
###############################################################################
# Configuration files
###############################################################################
set(CONFIG_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
install(DIRECTORY ${CONFIG_INCLUDE_DIR}/soci DESTINATION ${INCLUDEDIR})
set(CONFIG_FILE_IN "include/soci/soci-config.h.in")
set(CONFIG_FILE_OUT "${CONFIG_INCLUDE_DIR}/soci/soci-config.h")
###############################################################################
# Build configured components
###############################################################################
include(SociBackend)
include_directories(${SOCI_SOURCE_DIR}/include ${CONFIG_INCLUDE_DIR})
add_subdirectory(src)
if(SOCI_TESTS)
###############################################################################
# Enable tests
###############################################################################
enable_testing()
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} TEST_ACCESS_PATH)
configure_file(${PROJECT_SOURCE_DIR}/cmake/configs/test-access.cmake ${PROJECT_SOURCE_DIR}/tests/odbc/test-access.dsn @ONLY)
set(MYSQL_DRIVER_NAME "MySQL")
if(WIN32)
set(MYSQL_DRIVER_NAME "MySQL ODBC 5.3 ANSI Driver")
endif()
configure_file(${PROJECT_SOURCE_DIR}/cmake/configs/test-mysql.cmake ${PROJECT_SOURCE_DIR}/tests/odbc/test-mysql.dsn @ONLY)
# Define "make check" as alias for "make test"
add_custom_target(check COMMAND ctest)
add_subdirectory(tests)
###############################################################################
# Enable tests
###############################################################################
enable_testing()
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} TEST_ACCESS_PATH)
configure_file(${PROJECT_SOURCE_DIR}/cmake/configs/test-access.cmake ${PROJECT_SOURCE_DIR}/tests/odbc/test-access.dsn @ONLY)
set(MYSQL_DRIVER_NAME "MySQL")
if(WIN32)
set(MYSQL_DRIVER_NAME "MySQL ODBC 5.3 ANSI Driver")
endif()
configure_file(${PROJECT_SOURCE_DIR}/cmake/configs/test-mysql.cmake ${PROJECT_SOURCE_DIR}/tests/odbc/test-mysql.dsn @ONLY)
# Define "make check" as alias for "make test"
add_custom_target(check COMMAND ctest)
add_subdirectory(tests)
endif()
###############################################################################
......@@ -188,38 +188,22 @@ endif()
get_cmake_property(ALL_VARIABLES CACHE_VARIABLES)
set(CONFIGURED_VARIABLES)
foreach(v ${ALL_VARIABLES})
if (v MATCHES "^SOCI_HAVE.*")
get_property(CACHE_HELPSTRING CACHE ${v} PROPERTY HELPSTRING)
if (v MATCHES "^SOCI_HAVE.*")
get_property(CACHE_HELPSTRING CACHE ${v} PROPERTY HELPSTRING)
set(CONFIGURED_VARIABLES "${CONFIGURED_VARIABLES}\n// ${CACHE_HELPSTRING}\n")
if (${${v}})
set(CONFIGURED_VARIABLES "${CONFIGURED_VARIABLES}#define ${v}\n")
else()
set(CONFIGURED_VARIABLES "${CONFIGURED_VARIABLES}/* #undef ${v} */\n")
endif()
endif()
if (${${v}})
set(CONFIGURED_VARIABLES "${CONFIGURED_VARIABLES}#define ${v}\n")
else()
set(CONFIGURED_VARIABLES "${CONFIGURED_VARIABLES}/* #undef ${v} */\n")
endif()
endif()
endforeach()
configure_file("${CONFIG_FILE_IN}" "${CONFIG_FILE_OUT}")
message(STATUS "")
###############################################################################
# BC RPM
# CPack settings & RPM
###############################################################################
if (NOT CPACK_PACKAGE_NAME)
set(CPACK_PACKAGE_NAME "soci")
ENDIF()
set(CPACK_PACKAGE_VERSION_MAJOR "4")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
"${CMAKE_BINARY_DIR}"
"^${PROJECT_SOURCE_DIR}/.git*"
)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
include(CPack)
add_subdirectory(build)
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
############################################################################
# CMakeLists.txt
# Copyright (C) 2018 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
if(NOT CPACK_PACKAGE_NAME)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
ENDIF()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../COPYING")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PROJECT_VERSION})
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
"${CMAKE_BINARY_DIR}"
"^${PROJECT_SOURCE_DIR}/.git*"
)
message("-- Package file name is ${CPACK_PACKAGE_FILE_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
if(UNIX AND NOT APPLE AND NOT ANDROID)
configure_file("rpm/soci.spec.cmake" "${PROJECT_SOURCE_DIR}/soci.spec" @ONLY)
endif()
include(CPack)
# -*- rpm-spec -*-
## rpmbuild options
# These 2 lines are here because we can build the RPM for flexisip, in which
# case we prefix the entire installation so that we don't break compatibility
# with the user's libs.
# To compile with bc prefix, use rpmbuild -ba --with bc [SPEC]
%define pkg_name %{?_with_bc:bc-soci}%{!?_with_bc:soci}
%define _lib_name soci
%define _prefix /opt/belledonne-communications
# re-define some directories for older RPMBuild versions which don't. This messes up the doc/ dir
# taken from https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros
%define _datarootdir %{_prefix}/share
%define _datadir %{_datarootdir}
%define _docdir %{_datadir}/docs
%define _prefix @CMAKE_INSTALL_PREFIX@
%define pkg_prefix @BC_PACKAGE_NAME_PREFIX@
%define build_number 1
Name: %{pkg_name}
Version: 4.0.0
%define _lib_name soci
%define _is_set() %1 == "YES" || %1 == "ON" || %1 == "TRUE" || %1 == "1" || %1 == "Y"
%if %{_is_set "@WITH_DB2@"}
%define _with_db2 1
%endif
%if %{_is_set "@WITH_FIREBIRD@"}
%define _with_firebird 1
%endif
%if %{_is_set "@WITH_MYSQL@"}
%define _with_mysql 1
%endif
%if %{_is_set "@WITH_ODBC@"}
%define _with_odbc 1
%endif
%if %{_is_set "@WITH_ORACLE@"}
%define _with_oracle 1
%endif
%if %{_is_set "@WITH_POSTGRESQL@"}
%define _with_postgresql 1
%endif
%if %{_is_set "@WITH_SQLITE3@"}
%define _with_sqlite3 1
%endif
Name: @CPACK_PACKAGE_NAME@
Version: @PROJECT_VERSION@
Release: %{build_number}%{?dist}
Summary: The database access library for C++ programmers
Group: System Environment/Libraries
License: Boost
URL: http://soci.sourceforge.net/
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: boost-devel
%description
%{name} is a C++ database access library that provides the
illusion of embedding SQL in regular C++ code, staying entirely within
......@@ -48,19 +61,20 @@ dynamic library specific to the SQLite3 database. If you would like to
use %{name} in your programs with SQLite3, you will need to
install %{name}-sqlite3.}
%{?_with_mysql:%package mysql
Summary: MySQL back-end for %{name}
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
BuildRequires: mysql-devel
%description mysql
This package contains the MySQL back-end for %{name}, i.e.,
dynamic library specific to the MySQL database. If you would like to
use %{name} in your programs with MySQL, you will need to
install %{name}-mysql.}
%{?_with_postgresql:%package postgresql
Summary: PostGreSQL back-end for %{name}
Group: System Environment/Libraries
......@@ -73,6 +87,7 @@ dynamic library specific to the PostGreSQL database. If you would like
to use %{name} in your programs with PostGreSQL, you will need to
install %{name}-postgresql.}
%{?_with_odbc:%package odbc
Summary: ODBC back-end for %{name}
Group: System Environment/Libraries
......@@ -85,6 +100,7 @@ dynamic library specific to the ODBC connectors. If you would like to
use %{name} in your programs with ODBC, you will need to
install %{name}-odbc.}
%{?_with_oracle:%package oracle
Summary: Oracle back-end for %{name}
Group: System Environment/Libraries
......@@ -96,6 +112,7 @@ dynamic library specific to the Oracle database. If you would like to
use %{name} in your programs with Oracle, you will need to install
%{name}-oracle.}
%package devel
Summary: Header files, libraries and development documentation for %{name}
Group: Development/Libraries
......@@ -107,6 +124,7 @@ This package contains the header files, dynamic libraries and
development documentation for %{name}. If you would like to develop
programs using %{name}, you will need to install %{name}-devel.
%{?_with_sqlite3:%package sqlite3-devel
Summary: SQLite3 back-end for %{name}
Group: Development/Libraries
......@@ -120,6 +138,7 @@ files and dynamic libraries specific to the SQLite3 database. If you
would like to develop programs using %{name} and SQLite3, you will need
to install %{name}-sqlite3.}
%{?_with_mysql:%package mysql-devel
Summary: MySQL back-end for %{name}
Group: Development/Libraries
......@@ -133,6 +152,7 @@ files and dynamic libraries specific to the MySQL database. If you
would like to develop programs using %{name} and MySQL, you will need
to install %{name}-mysql.}
%{?_with_postgresql:%package postgresql-devel
Summary: PostGreSQL back-end for %{name}
Group: Development/Libraries
......@@ -146,6 +166,7 @@ files and dynamic libraries specific to the PostGreSQL database. If
you would like to develop programs using %{name} and PostGreSQL, you
will need to install %{name}-postgresql.}
%{?_with_odbc:%package odbc-devel
Summary: ODBC back-end for %{name}
Group: Development/Libraries
......@@ -159,6 +180,7 @@ files and dynamic libraries specific to the Odbc database. If you
would like to develop programs using %{name} and Odbc, you will need
to install %{name}-odbc.}
%{?_with_oracle:%package oracle-devel
Summary: Oracle back-end for %{name}
Group: Development/Libraries
......@@ -171,6 +193,7 @@ files and dynamic libraries specific to the Oracle database. If you
would like to develop programs using %{name} and Oracle, you will need
to install %{name}-oracle.}
%package doc
Summary: HTML documentation for the %{name} library
Group: Documentation
......@@ -184,6 +207,7 @@ BuildArch: noarch
This package contains the documentation in the HTML format of the %{name}
library. The documentation is the same as at the %{name} web page.
%if 0%{?rhel} && 0%{?rhel} <= 7
%global cmake_name cmake3
%else
......@@ -195,43 +219,44 @@ library. The documentation is the same as at the %{name} web page.
mv README.md README
mv CHANGES ChangeLog
mv LICENSE_1_0.txt COPYING
echo "2017-12-06:" > NEWS
echo "- Version 4.0.0" >> NEWS
echo "- See the ChangeLog file for more details." >> NEWS
%build
# -DCMAKE_INSTALL_PREFIX:PATH=$RPM_BUILD_ROOT
%{expand:%%%cmake_name} . \
-DSOCI_TESTS=OFF \
-DSOCI_EMPTY=OFF \
-DSOCI_CXX_C11=ON \
-DWITH_EMPTY=%{?_with_empty:ON}%{!?_with_empty:OFF} \
-DWITH_DB2=%{?_with_db2:ON}%{!?with_db2:OFF} \
-DWITH_SQLITE3=%{?_with_sqlite3:ON}%{!?with_sqlite3:OFF} \
-DWITH_POSTGRESQL=%{?_with_postgresql:ON}%{!?with_postgresql:OFF} \
-DWITH_MYSQL=%{?_with_mysql:ON}%{!?with_mysql:OFF} \
-DWITH_ODBC=%{?_with_odbc:ON}%{!?with_odbc:OFF} \
-DWITH_ORACLE=%{?_with_oracle:ON %{?_with_oracle_incdir} %{?_with_oracle_libdir}}%{!?with_oracle:OFF} \
-DWITH_FIREBIRD=%{?_with_firebird:ON}%{!?with_firebird:OFF}
make VERBOSE=1 %{?_smp_mflags}
-DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ \
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
-DCMAKE_PREFIX_PATH:PATH=%{_prefix} \
-DSOCI_CXX_C11=ON \
-DSOCI_EMPTY=OFF \
-DSOCI_TESTS=OFF \
-DWITH_DB2=@WITH_DB2@ \
-DWITH_FIREBIRD=@WITH_FIREBIRD@ \
-DWITH_MYSQL=@WITH_MYSQL@ \
-DWITH_ODBC=@WITH_ODBC@ \
-DWITH_ORACLE=@WITH_ORACLE@ \
-DWITH_POSTGRESQL=@WITH_POSTGRESQL@ \
-DWITH_SQLITE3=@WITH_SQLITE3@
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
##
make install DESTDIR=%{buildroot}
# Remove unpackaged files from the buildroot
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_includedir}/soci/soci-config.h.in
%{!?_with_empty:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/empty}
rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/empty
%{!?_with_db2:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/db2}
%{!?_with_sqlite3:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/sqlite3}
%{!?_with_postgresql:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/postgresql}
%{!?_with_firebird:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/firebird}
%{!?_with_mysql:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/mysql}
%{!?_with_odbc:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/odbc}
%{!?_with_oracle:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/oracle}
%{!?_with_firebird:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/firebird}
%{!?_with_postgresql:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/postgresql}
%{!?_with_sqlite3:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/sqlite3}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
......@@ -315,5 +340,8 @@ rm -f $RPM_BUILD_ROOT%{_includedir}/soci/soci-config.h.in
%doc AUTHORS ChangeLog COPYING NEWS README docs
%changelog
* Tue Oct 30 2018 ronan.abhamon <ronan.abhamon@belledonne-communications.com>
- Use CPack.
* Wed Dec 6 2017 erwan.croze <erwan.croze@belledonne.communications.com>
- Initial RPM release.
......@@ -19,10 +19,6 @@
#
# List of SOCI dependncies
#
set(SOCI_CORE_DEPENDENCIES
Threads
Boost)
set(SOCI_BACKENDS_DB_DEPENDENCIES
MySQL
ODBC
......@@ -30,11 +26,8 @@ set(SOCI_BACKENDS_DB_DEPENDENCIES
PostgreSQL
SQLite3
Firebird
DB2)
set(SOCI_ALL_DEPENDENCIES
${SOCI_CORE_DEPENDENCIES}
${SOCI_BACKENDS_DB_DEPENDENCIES})
DB2
)
#
# Perform checks
......@@ -71,9 +64,11 @@ option(WITH_VALGRIND "Run tests under valgrind" OFF)
#
# Detect available dependencies
#
foreach(external ${SOCI_ALL_DEPENDENCIES})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies/Threads.cmake)
foreach(external ${SOCI_BACKENDS_DB_DEPENDENCIES})
string(TOUPPER "${external}" EXTERNAL)
option(WITH_${EXTERNAL} "Attempt to find and configure ${external}" ON)
option(WITH_${EXTERNAL} "Attempt to find and configure ${external}" OFF)
if(WITH_${EXTERNAL})
colormsg(HICYAN "${external}:")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies/${external}.cmake)
......
set(DB2_FIND_QUIETLY TRUE)
find_package(DB2)
find_package(DB2 REQUIRED)
boost_external_report(DB2 INCLUDE_DIR LIBRARIES)
......@@ -3,7 +3,6 @@ boost_report_value(SOCI_FIREBIRD_EMBEDDED)
set(Firebird_FIND_QUIETLY TRUE)
find_package(Firebird)
find_package(Firebird REQUIRED)
boost_external_report(Firebird INCLUDE_DIR LIBRARIES VERSION)
set(MySQL_FIND_QUIETLY TRUE)
find_package(MySQL)
find_package(MySQL REQUIRED)
boost_external_report(MySQL INCLUDE_DIR LIBRARIES)
set(ODBC_FIND_QUIETLY TRUE)
find_package(ODBC)
find_package(ODBC REQUIRED)
boost_external_report(ODBC INCLUDE_DIR LIBRARIES)
set(ORACLE_FIND_QUIETLY TRUE)
find_package(Oracle)
find_package(Oracle REQUIRED)
boost_external_report(Oracle INCLUDE_DIR LIBRARIES)
set(PostgreSQL_FIND_QUIETLY TRUE)
find_package(PostgreSQL)
find_package(PostgreSQL REQUIRED)
boost_external_report(PostgreSQL INCLUDE_DIRS LIBRARIES VERSION)
set(SQLITE3_FIND_QUIETLY TRUE)
find_package(SQLite3)
find_package(SQLite3 REQUIRED)
boost_external_report(SQLite3 INCLUDE_DIR LIBRARIES)
......@@ -93,7 +93,7 @@ List of variables to control common SOCI features and dependencies:
#### Empty (sample backend)
* `SOCI_EMPTY` - boolean - Builds the [sample backend](backends/index.md) called Empty. Always ON by default.
* `SOCI_EMPTY` - boolean - Builds the [sample backend](backends/index.md) called Empty. Always OFF by default.
* `SOCI_EMPTY_TEST_CONNSTR` - string - Connection string used to run regression tests of the Empty backend. It is a dummy value. Example: `-DSOCI_EMPTY_TEST_CONNSTR="dummy connection"`
#### IBM DB2
......
......@@ -27,8 +27,8 @@ endforeach()
# get all files in backends
file(GLOB backend_dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
# empty backend always on by default
option(SOCI_EMPTY "Build empty backend" ON)
# empty backend always off by default
option(SOCI_EMPTY "Build empty backend" OFF)
if(SOCI_EMPTY)
set(WITH_EMPTY ON)
set(EMPTY_FOUND ON)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment