mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
Added a proper "src/CMakeLists.txt" file defining the static library.
- This enable using this SQLiteCpp repository as a Git submodule, - simply add_subdirectory (SQLiteCpp/src) to you main CMakeLists.txt and link to the "SQLiteCpp" wrapper library.
This commit is contained in:
parent
a8b471e7ed
commit
d75c7a9449
5
.gitignore
vendored
5
.gitignore
vendored
@ -2,6 +2,7 @@ Debug
|
|||||||
Release
|
Release
|
||||||
build
|
build
|
||||||
|
|
||||||
|
/SQLiteCpp.sln
|
||||||
*.ncb
|
*.ncb
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
@ -14,4 +15,8 @@ core
|
|||||||
.settings/
|
.settings/
|
||||||
|
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
*.cmake
|
*.cmake
|
||||||
|
*.dir
|
||||||
|
Testing
|
||||||
|
Win32
|
||||||
|
@ -1,35 +1,36 @@
|
|||||||
|
# Main CMake file compiling the library itself, examples and tests.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
#
|
||||||
|
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
# or copy at http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.6)
|
||||||
project (SQLiteCpp)
|
project (SQLiteCpp)
|
||||||
|
|
||||||
if(MSVC)
|
if (MSVC)
|
||||||
|
# build the SQLite3 C library for windows build (for ease of use)
|
||||||
include_directories ("${PROJECT_SOURCE_DIR}/sqlite3")
|
include_directories ("${PROJECT_SOURCE_DIR}/sqlite3")
|
||||||
add_library (sqlite3 sqlite3/sqlite3.c sqlite3/sqlite3.h)
|
add_library (sqlite3 sqlite3/sqlite3.c sqlite3/sqlite3.h)
|
||||||
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
# disable Visual Studio warnings for fopen() used in the example
|
||||||
add_definitions(-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Weffc++ -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn)
|
add_definitions (/D_CRT_SECURE_NO_WARNINGS)
|
||||||
endif()
|
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
# GCC flags
|
||||||
|
add_definitions (-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Weffc++ -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# add the wrapper as a library
|
################################################################################
|
||||||
add_library(SQLiteCpp
|
# add the subdirectory containing the CMakeLists.txt of the library
|
||||||
src/SQLiteC++.h
|
add_subdirectory (src)
|
||||||
src/Column.cpp
|
include_directories ("${PROJECT_SOURCE_DIR}/src")
|
||||||
src/Column.h
|
################################################################################
|
||||||
src/Database.cpp
|
|
||||||
src/Database.h
|
|
||||||
src/Exception.h
|
|
||||||
src/Statement.cpp
|
|
||||||
src/Statement.h
|
|
||||||
src/Transaction.cpp
|
|
||||||
src/Transaction.h
|
|
||||||
)
|
|
||||||
|
|
||||||
# add the exemple1 executable, linked with the wrapper library
|
# add the example1 executable, linked with the wrapper library
|
||||||
add_executable(example1 examples/example1/main.cpp)
|
add_executable (example1 examples/example1/main.cpp)
|
||||||
target_link_libraries (example1 SQLiteCpp sqlite3)
|
target_link_libraries (example1 SQLiteCpp sqlite3)
|
||||||
|
|
||||||
# add a "test" target:
|
# add a "test" target:
|
||||||
enable_testing()
|
enable_testing ()
|
||||||
|
|
||||||
# does the example1 runs successfully
|
# does the example1 runs successfully
|
||||||
add_test (Example1Run example1)
|
add_test (Example1Run example1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,7 +81,11 @@ in a custom shared pointer (See the inner class "Statement::Ptr").
|
|||||||
To use this wrappers, you need to add the 10 SQLiteC++ source files from the src/ directory
|
To use this wrappers, you need to add the 10 SQLiteC++ source files from the src/ directory
|
||||||
in your project code base, and compile/link against the sqlite library.
|
in your project code base, and compile/link against the sqlite library.
|
||||||
|
|
||||||
You can also build the wrapper as a library; this is how CMake link the examples.
|
The easiest way to do this is to add the wrapper as a library.
|
||||||
|
The proper "CMakeLists.txt" file defining the static library is provided in the src/ subdirectory,
|
||||||
|
so you simply have to add_directory(SQLiteCpp/src) to you main CMakeLists.txt
|
||||||
|
and link to the "SQLiteCpp" wrapper library.
|
||||||
|
Thus this SQLiteCpp repository can directly be used as a Git submoldule.
|
||||||
|
|
||||||
### Building the examples:
|
### Building the examples:
|
||||||
|
|
||||||
|
2
TODO.txt
2
TODO.txt
@ -1,3 +1,5 @@
|
|||||||
|
Create a "SQLiteCppExample" repository using the wrapper as a Git submodule.
|
||||||
|
|
||||||
Check C++11 explicit support
|
Check C++11 explicit support
|
||||||
|
|
||||||
Add a FAQ.txt
|
Add a FAQ.txt
|
||||||
|
24
src/CMakeLists.txt
Normal file
24
src/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# CMake file for compiling the wrapper static library itself.
|
||||||
|
#
|
||||||
|
# This allow for easy use of SQLiteC++ as a Git submodule;
|
||||||
|
# simply use add_subdirectory (SQLiteCpp/src) into your main CMakeLists.txt file,
|
||||||
|
# and link to the "SQLiteCpp" library
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
|
#
|
||||||
|
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
|
# or copy at http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
# add sources of the wrapper as a "SQLiteCpp" static library
|
||||||
|
add_library (SQLiteCpp
|
||||||
|
SQLiteC++.h
|
||||||
|
Column.cpp
|
||||||
|
Column.h
|
||||||
|
Database.cpp
|
||||||
|
Database.h
|
||||||
|
Exception.h
|
||||||
|
Statement.cpp
|
||||||
|
Statement.h
|
||||||
|
Transaction.cpp
|
||||||
|
Transaction.h
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user