mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-02-06 05:39:19 -06:00
Feature/fetch content (#349)
* Add date as a dependency, make fetch friendly * Add example * Add alias * Update readme * Add find_package example * Update travis * Add license
This commit is contained in:
17
.travis.yml
17
.travis.yml
@@ -4,7 +4,7 @@ os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
sudo: required
|
||||
|
||||
compiler:
|
||||
@@ -23,12 +23,15 @@ notifications:
|
||||
|
||||
install:
|
||||
- g++ --version
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew upgrade cmake; fi
|
||||
- cmake --version
|
||||
- git clone https://github.com/HowardHinnant/date
|
||||
- cd date
|
||||
- git checkout tags/v2.4
|
||||
- cd ..
|
||||
- 'if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
brew upgrade cmake;
|
||||
else
|
||||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null &&
|
||||
sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ bionic main" &&
|
||||
sudo apt-get update -qq -y &&
|
||||
sudo apt-get install -y cmake &&
|
||||
sudo rm -r /usr/local/cmake-3.12.4/;
|
||||
fi'
|
||||
|
||||
before_script:
|
||||
- mkdir build
|
||||
|
||||
@@ -23,19 +23,24 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
||||
### Preamble
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(sqlpp11 VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
enable_testing()
|
||||
### Project Wide Setup
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
|
||||
option(ENABLE_TESTS "Build unit tests" On)
|
||||
include(CTest)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||
find_package(HinnantDate REQUIRED)
|
||||
|
||||
### Dependencies
|
||||
add_subdirectory(dependencies)
|
||||
|
||||
### Main targets
|
||||
add_library(sqlpp11 INTERFACE)
|
||||
add_library(sqlpp11::sqlpp11 ALIAS sqlpp11)
|
||||
|
||||
target_link_libraries(sqlpp11 INTERFACE HinnantDate::Date)
|
||||
target_link_libraries(sqlpp11 INTERFACE date::date)
|
||||
|
||||
target_include_directories(sqlpp11 INTERFACE
|
||||
$<BUILD_INTERFACE:${sqlpp11_SOURCE_DIR}/include>
|
||||
@@ -64,6 +69,7 @@ target_compile_features(sqlpp11 INTERFACE
|
||||
cxx_variadic_templates
|
||||
)
|
||||
|
||||
### Packaging
|
||||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/sqlpp11"
|
||||
DESTINATION include
|
||||
)
|
||||
@@ -96,8 +102,7 @@ configure_file(cmake/Sqlpp11Config.cmake
|
||||
|
||||
set(ConfigPackageLocation lib/cmake/Sqlpp11)
|
||||
install(EXPORT Sqlpp11Targets
|
||||
FILE
|
||||
Sqlpp11Targets.cmake
|
||||
NAMESPACE sqlpp11::
|
||||
DESTINATION
|
||||
${ConfigPackageLocation}
|
||||
)
|
||||
@@ -106,12 +111,12 @@ install(
|
||||
FILES
|
||||
"cmake/Sqlpp11Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/Sqlpp11ConfigVersion.cmake"
|
||||
"cmake/Modules/FindHinnantDate.cmake"
|
||||
DESTINATION
|
||||
${ConfigPackageLocation}
|
||||
)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
### Tests
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(test_types)
|
||||
add_subdirectory(test_serializer)
|
||||
|
||||
24
README.md
24
README.md
@@ -135,27 +135,23 @@ To demonstrate that sqlpp11 can work with other backends as well, here is an exp
|
||||
* STL Container: https://github.com/rbock/sqlpp11-connector-stl
|
||||
|
||||
__Date Library:__
|
||||
sqlpp11 requires [Howard Hinnant's date library](https://github.com/HowardHinnant/date) for `date` and `date_time` data types. Sqlpp11 includes CMake search module for this, but if you didn't install this library system-wide, you need to point cmake to it:
|
||||
|
||||
```
|
||||
cmake -DHinnantDate_ROOT_DIR=/%PATH_TO_HinnantDate_SOURCE%/
|
||||
```
|
||||
sqlpp11 requires [Howard Hinnant's date library](https://github.com/HowardHinnant/date) for `date` and `date_time` data types. Sqlpp11 uses FetchContent to pull the library automatically in the project.
|
||||
|
||||
Build and Install
|
||||
-----------------
|
||||
|
||||
**Note**: Depending on how you use the lib, you might not need to install it (see Basic Usage)
|
||||
|
||||
__Build from Source:__
|
||||
|
||||
Download and unpack the latest release from https://github.com/rbock/sqlpp11/releases or clone the repository. Inside the directory run the following commands:
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
make install
|
||||
cmake -B build
|
||||
cmake --build build --target install
|
||||
```
|
||||
|
||||
The last step will install the library system wide.
|
||||
The last step will build the library and install it system wide, therefore it might need admins right.
|
||||
|
||||
__Install via Homebrew (MacOS):__
|
||||
|
||||
@@ -186,6 +182,12 @@ The following connector libraries for sqlpp11 are maintained as a separate packa
|
||||
|
||||
Basic usage:
|
||||
-------------
|
||||
__Use with cmake__:
|
||||
The library officially supports two ways how it can be used with cmake.
|
||||
You can find examples for both methods in the example folder.
|
||||
|
||||
1. Fetch content (Recommend, no installation required)
|
||||
1. Find package (installation required, see above)
|
||||
|
||||
__Create DDL files__:
|
||||
```
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
#.rst:
|
||||
# FindHinnantDate
|
||||
# ---------------
|
||||
#
|
||||
# This module finds Howard Hinnant's date and time library for C++11 and beyond
|
||||
# See https://github.com/HowardHinnant/date for details.
|
||||
#
|
||||
# This will define the following variables::
|
||||
#
|
||||
# HinnantDate_FOUND - True if the system has the library
|
||||
# HinnantDate_INCLUDE_DIR - The directory which includes the header
|
||||
# HinnantDate_ROOT_DIR - The base directory of the library
|
||||
#
|
||||
# and the following imported targets::
|
||||
#
|
||||
# HinnantDate::Date - The target to use date/date.h
|
||||
#
|
||||
# You can set HinnantDate_ROOT_DIR as hint to the location of the library.
|
||||
#
|
||||
# The target will enable the required C++11 standard in your compiler. You can
|
||||
# use any later standard but you have to enable them explicitly.
|
||||
|
||||
# Copyright (c) 2016 Christian Dávid
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
# ensure cache entry
|
||||
set(HinnantDate_ROOT_DIR "${HinnantDate_ROOT_DIR}" CACHE PATH "Root directory of Howard Hinnant's date library")
|
||||
set(HinnantDate_NOT_FOUND_MESSAGE "Could NOT find HinnantDate.
|
||||
Maybe you need to adjust the search paths or HinnantDate_ROOT_DIR.")
|
||||
|
||||
find_file(HinnantDate_INCLUDE_FILE
|
||||
date/date.h include/date/date.h
|
||||
HINTS
|
||||
${HinnantDate_ROOT_DIR}
|
||||
${HinnantDate_ROOT_DIR}/include
|
||||
)
|
||||
mark_as_advanced(HinnantDate_INCLUDE_FILE)
|
||||
|
||||
if (HinnantDate_INCLUDE_FILE)
|
||||
# Validate that correct file is found
|
||||
file(STRINGS ${HinnantDate_INCLUDE_FILE} check_result
|
||||
LIMIT_COUNT 1
|
||||
REGEX "^ *// Copyright [(]c[)] 2015.* Howard Hinnant *$"
|
||||
)
|
||||
|
||||
if("${check_result}" STREQUAL "")
|
||||
string(APPEND HinnantDate_NOT_FOUND_MESSAGE "\nRejecting found '${HinnantDate_INCLUDE_FILE}', it seems to be a name twin.")
|
||||
unset(HinnantDate_INCLUDE_FILE CACHE)
|
||||
else()
|
||||
# Check succeeded, create target
|
||||
get_filename_component(HinnantDate_INCLUDE_DIR "${HinnantDate_INCLUDE_FILE}" DIRECTORY) # remove filename
|
||||
get_filename_component(HinnantDate_INCLUDE_DIR "${HinnantDate_INCLUDE_DIR}" DIRECTORY) # remove date dir
|
||||
mark_as_advanced(HinnantDate_INCLUDE_DIR)
|
||||
set(HinnantDate_ROOT_DIR "${HinnantDate_INCLUDE_DIR}")
|
||||
unset(HinnantDate_NOT_FOUND_MESSAGE)
|
||||
|
||||
if(NOT TARGET HinnantDate::Date)
|
||||
add_library(HinnantDate::Date INTERFACE IMPORTED)
|
||||
set_target_properties(HinnantDate::Date PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${HinnantDate_INCLUDE_DIR}"
|
||||
INTERFACE_COMPILE_FEATURES "cxx_auto_type;cxx_static_assert;cxx_decltype;cxx_alias_templates;cxx_strong_enums"
|
||||
# Due to cmake restrictions the standard cannot be set directly to interface imported targets. Instead required compile
|
||||
# features are set (list maybe incomplete). Please note that this list shall be a minimal set of required features.
|
||||
# CXX_STANDARD 11
|
||||
# CXX_STANDARD_REQUIRED true
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(HinnantDate
|
||||
REQUIRED_VARS HinnantDate_ROOT_DIR HinnantDate_INCLUDE_DIR
|
||||
FAIL_MESSAGE ${HinnantDate_NOT_FOUND_MESSAGE}
|
||||
)
|
||||
@@ -26,7 +26,7 @@
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(HinnantDate REQUIRED)
|
||||
find_dependency(date REQUIRED)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/Sqlpp11Targets.cmake")
|
||||
|
||||
|
||||
32
dependencies/CMakeLists.txt
vendored
Normal file
32
dependencies/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(date
|
||||
GIT_REPOSITORY https://github.com/HowardHinnant/date.git
|
||||
GIT_TAG v3.0.0
|
||||
)
|
||||
|
||||
add_subdirectory(hinnant_date)
|
||||
25
dependencies/hinnant_date/CMakeLists.txt
vendored
Normal file
25
dependencies/hinnant_date/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
FetchContent_MakeAvailable(date)
|
||||
38
examples/usage_fetch_content/CMakeLists.txt
Normal file
38
examples/usage_fetch_content/CMakeLists.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
### Preamble ###
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(Test VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
##### Project wide setup ####
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
### Dependencies ###
|
||||
add_subdirectory(dependencies)
|
||||
|
||||
### Main Targets ###
|
||||
add_subdirectory(src)
|
||||
32
examples/usage_fetch_content/dependencies/CMakeLists.txt
Normal file
32
examples/usage_fetch_content/dependencies/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(sqlpp11
|
||||
GIT_REPOSITORY https://github.com/rbock/sqlpp11
|
||||
GIT_TAG origin/develop
|
||||
)
|
||||
|
||||
add_subdirectory(sqlpp11)
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Configure before sqlpp11
|
||||
FetchContent_MakeAvailable(sqlpp11)
|
||||
31
examples/usage_fetch_content/src/CMakeLists.txt
Normal file
31
examples/usage_fetch_content/src/CMakeLists.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
add_executable(Test)
|
||||
target_link_libraries(Test PRIVATE sqlpp11::sqlpp11)
|
||||
|
||||
target_sources(Test
|
||||
PRIVATE
|
||||
main.cpp
|
||||
)
|
||||
8
examples/usage_fetch_content/src/main.cpp
Normal file
8
examples/usage_fetch_content/src/main.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <sqlpp11/select.h>
|
||||
#include <sqlpp11/alias_provider.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
select(sqlpp::value(false).as(sqlpp::alias::a));
|
||||
return 0;
|
||||
}
|
||||
38
examples/usage_find_package/CMakeLists.txt
Normal file
38
examples/usage_find_package/CMakeLists.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
### Preamble ###
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(Test VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
##### Project wide setup ####
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
### Dependencies ###
|
||||
find_package(Sqlpp11 REQUIRED)
|
||||
|
||||
### Main Targets ###
|
||||
add_subdirectory(src)
|
||||
31
examples/usage_find_package/src/CMakeLists.txt
Normal file
31
examples/usage_find_package/src/CMakeLists.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2020, Leon De Andrade
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice, this
|
||||
# list of conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
add_executable(Test)
|
||||
target_link_libraries(Test PRIVATE sqlpp11::sqlpp11)
|
||||
|
||||
target_sources(Test
|
||||
PRIVATE
|
||||
main.cpp
|
||||
)
|
||||
8
examples/usage_find_package/src/main.cpp
Normal file
8
examples/usage_find_package/src/main.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <sqlpp11/select.h>
|
||||
#include <sqlpp11/alias_provider.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
select(sqlpp::value(false).as(sqlpp::alias::a));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user