Skip to content

Commit 2839628

Browse files
committed
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.
1 parent 59a047b commit 2839628

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ cmake_minimum_required(VERSION 3.5)
88
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # custom CMake modules like FindSQLiteCpp
99
project(SQLiteCpp VERSION 3.3.3)
1010

11-
# SQLiteC++ 3.x requires C++11 features
12-
if (NOT CMAKE_CXX_STANDARD)
13-
set(CMAKE_CXX_STANDARD 11)
14-
elseif (CMAKE_CXX_STANDARD LESS 11)
15-
message(WARNING "CMAKE_CXX_STANDARD has been set to '${CMAKE_CXX_STANDARD}' which is lower than the minimum required standard (c++11).")
16-
endif ()
17-
message(STATUS "Using c++ standard c++${CMAKE_CXX_STANDARD}")
18-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
19-
2011
message (STATUS "CMake version: ${CMAKE_VERSION}")
2112
message (STATUS "Project version: ${PROJECT_VERSION}")
2213

@@ -213,6 +204,9 @@ endif()
213204
# add sources of the wrapper as a "SQLiteCpp" static library
214205
add_library(SQLiteCpp ${SQLITECPP_SRC} ${SQLITECPP_INC} ${SQLITECPP_DOC} ${SQLITECPP_SCRIPT})
215206

207+
# set minimum version to c++11
208+
target_compile_features(SQLiteCpp PUBLIC cxx_std_11)
209+
216210
# Options relative to SQLite and SQLiteC++ functions
217211

218212
option(SQLITE_ENABLE_COLUMN_METADATA "Enable Column::getColumnOriginName(). Require support from sqlite3 library." ON)

0 commit comments

Comments
 (0)