From d867587bff53ff4160a62e35e54a60dc73ea4034 Mon Sep 17 00:00:00 2001 From: Scott Bailey Date: Tue, 30 Jul 2024 12:34:39 -0500 Subject: [PATCH 1/2] Add working sqlite example. --- examples/sqlite/CMakeLists.txt | 19 +++++++++++++++++++ examples/sqlite/main.cpp | 8 ++++++++ examples/sqlite/sqlite.patch | 11 +++++++++++ 3 files changed, 38 insertions(+) create mode 100644 examples/sqlite/CMakeLists.txt create mode 100644 examples/sqlite/main.cpp create mode 100644 examples/sqlite/sqlite.patch diff --git a/examples/sqlite/CMakeLists.txt b/examples/sqlite/CMakeLists.txt new file mode 100644 index 00000000..8f0ba4e2 --- /dev/null +++ b/examples/sqlite/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.14 FATAL_ERROR) + +project(CPMSqliteExample) + +# ---- Dependencies ---- + +include(../../cmake/CPM.cmake) + +# sqlite - You know it, you love it! +CPMAddPackage( + NAME sqlite + URL https://www.sqlite.org/2024/sqlite-amalgamation-3460000.zip + URL_HASH SHA256=712a7d09d2a22652fb06a49af516e051979a3984adb067da86760e60ed51a7f5 + PATCHES + sqlite.patch +) + +add_executable(CPMSqliteExample main.cpp) +target_link_libraries(CPMSqliteExample sqlite) diff --git a/examples/sqlite/main.cpp b/examples/sqlite/main.cpp new file mode 100644 index 00000000..0ecabb34 --- /dev/null +++ b/examples/sqlite/main.cpp @@ -0,0 +1,8 @@ +#include +#include + + +int main(int,char**) { + std::cout << sqlite3_libversion() << "\n"; + return 0; +} diff --git a/examples/sqlite/sqlite.patch b/examples/sqlite/sqlite.patch new file mode 100644 index 00000000..7096dd6d --- /dev/null +++ b/examples/sqlite/sqlite.patch @@ -0,0 +1,11 @@ +diff -uN a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 1969-12-31 18:00:00.000000000 -0600 ++++ b/CMakeLists.txt 2024-07-30 12:22:59.022590360 -0500 +@@ -0,0 +1,7 @@ ++cmake_minimum_required(VERSION 3.11) ++project(sqlite) ++ ++add_library(sqlite STATIC sqlite3.c sqlite3.h sqlite3ext.h) ++target_include_directories(sqlite PUBLIC SYSTEM ++ "${CMAKE_CURRENT_SOURCE_DIR}" ++) From 4a1b63eac0ade0e67c9044be83baad56d03b6f23 Mon Sep 17 00:00:00 2001 From: Scott Bailey Date: Tue, 30 Jul 2024 12:44:49 -0500 Subject: [PATCH 2/2] standards --- examples/sqlite/CMakeLists.txt | 7 +++---- examples/sqlite/main.cpp | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/sqlite/CMakeLists.txt b/examples/sqlite/CMakeLists.txt index 8f0ba4e2..4c793fd1 100644 --- a/examples/sqlite/CMakeLists.txt +++ b/examples/sqlite/CMakeLists.txt @@ -8,11 +8,10 @@ include(../../cmake/CPM.cmake) # sqlite - You know it, you love it! CPMAddPackage( - NAME sqlite - URL https://www.sqlite.org/2024/sqlite-amalgamation-3460000.zip + NAME sqlite + URL https://www.sqlite.org/2024/sqlite-amalgamation-3460000.zip URL_HASH SHA256=712a7d09d2a22652fb06a49af516e051979a3984adb067da86760e60ed51a7f5 - PATCHES - sqlite.patch + PATCHES sqlite.patch ) add_executable(CPMSqliteExample main.cpp) diff --git a/examples/sqlite/main.cpp b/examples/sqlite/main.cpp index 0ecabb34..610c9f05 100644 --- a/examples/sqlite/main.cpp +++ b/examples/sqlite/main.cpp @@ -1,8 +1,8 @@ -#include #include +#include -int main(int,char**) { +int main(int, char**) { std::cout << sqlite3_libversion() << "\n"; return 0; }