From 9cff22b4dc9caf0a4449325854860b5943302164 Mon Sep 17 00:00:00 2001 From: Simon Gene Gottlieb Date: Fri, 23 May 2025 20:30:17 +0200 Subject: [PATCH 1/2] fix: update the c++ version selection process The c++ version should be set via `target_compile_features(SQLiteCpp PUBLIC cxx_std_11)` This only sets this as a minimum version for this target, and not all targets. --- CMakeLists.txt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab2034db..2cb14ca4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,15 +8,6 @@ cmake_minimum_required(VERSION 3.5) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # custom CMake modules like FindSQLiteCpp project(SQLiteCpp VERSION 3.3.3) -# SQLiteC++ 3.x requires C++11 features -if (NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) -elseif (CMAKE_CXX_STANDARD LESS 11) - message(WARNING "CMAKE_CXX_STANDARD has been set to '${CMAKE_CXX_STANDARD}' which is lower than the minimum required standard (c++11).") -endif () -message(STATUS "Using c++ standard c++${CMAKE_CXX_STANDARD}") -set(CMAKE_CXX_STANDARD_REQUIRED ON) - message (STATUS "CMake version: ${CMAKE_VERSION}") message (STATUS "Project version: ${PROJECT_VERSION}") @@ -213,6 +204,9 @@ endif() # add sources of the wrapper as a "SQLiteCpp" static library add_library(SQLiteCpp ${SQLITECPP_SRC} ${SQLITECPP_INC} ${SQLITECPP_DOC} ${SQLITECPP_SCRIPT}) +# set minimum version to c++11 +target_compile_features(SQLiteCpp PUBLIC cxx_std_11) + # Options relative to SQLite and SQLiteC++ functions option(SQLITE_ENABLE_COLUMN_METADATA "Enable Column::getColumnOriginName(). Require support from sqlite3 library." ON) From 21c371ac9ecb81af7de1c609813a37e002d948ae Mon Sep 17 00:00:00 2001 From: Simon Gene Gottlieb Date: Fri, 6 Jun 2025 11:13:59 +0200 Subject: [PATCH 2/2] fix: bump cmake minimum version --- CMakeLists.txt | 2 +- examples/example2/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cb14ca4..d7ae863e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt # or copy at http://opensource.org/licenses/MIT) -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.8) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # custom CMake modules like FindSQLiteCpp project(SQLiteCpp VERSION 3.3.3) diff --git a/examples/example2/CMakeLists.txt b/examples/example2/CMakeLists.txt index 3257b3e7..199555c6 100644 --- a/examples/example2/CMakeLists.txt +++ b/examples/example2/CMakeLists.txt @@ -4,7 +4,7 @@ # # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt # or copy at http://opensource.org/licenses/MIT) -cmake_minimum_required(VERSION 3.1) # for "CMAKE_CXX_STANDARD" version +cmake_minimum_required(VERSION 3.8) # for "CMAKE_CXX_STANDARD" version project(SQLiteCpp_Example VERSION 2.0) # SQLiteC++ 3.x now requires C++11 compiler