Skip to content

Commit 25dad15

Browse files
committed
Add working sqlite example.
1 parent 76ca486 commit 25dad15

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

examples/sqlite/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
2+
3+
project(CPMSqliteExample)
4+
5+
# ---- Dependencies ----
6+
7+
include(../../cmake/CPM.cmake)
8+
9+
# sqlite - You know it, you love it!
10+
CPMAddPackage(
11+
NAME sqlite
12+
URL https://www.sqlite.org/2024/sqlite-amalgamation-3460000.zip
13+
URL_HASH SHA256=712a7d09d2a22652fb06a49af516e051979a3984adb067da86760e60ed51a7f5
14+
PATCHES
15+
sqlite.patch
16+
)
17+
18+
add_executable(CPMSqliteExample main.cpp)
19+
target_link_libraries(CPMSqliteExample sqlite)

examples/sqlite/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <iostream>
2+
#include <sqlite3.h>
3+
4+
5+
int main(int,char**) {
6+
std::cout << sqlite3_libversion() << "\n";
7+
return 0;
8+
}

examples/sqlite/sqlite.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff -uN a/CMakeLists.txt b/CMakeLists.txt
2+
--- a/CMakeLists.txt 1969-12-31 18:00:00.000000000 -0600
3+
+++ b/CMakeLists.txt 2024-07-30 12:22:59.022590360 -0500
4+
@@ -0,0 +1,7 @@
5+
+cmake_minimum_required(VERSION 3.11)
6+
+project(sqlite)
7+
+
8+
+add_library(sqlite STATIC sqlite3.c sqlite3.h sqlite3ext.h)
9+
+target_include_directories(sqlite PUBLIC SYSTEM
10+
+ "${CMAKE_CURRENT_SOURCE_DIR}"
11+
+)

0 commit comments

Comments
 (0)