Skip to content

Commit

Permalink
Enabled C++ 20 if it is available.
Browse files Browse the repository at this point in the history
Had to remove CMAKE_CXX_STANDARD_REQUIRED because it would have caused requiring too high standard on opportunistic upgrade
  • Loading branch information
KOLANICH committed Jan 13, 2020
1 parent 8485bb7 commit 38cbef7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,23 @@ project(SQLiteCpp VERSION "2.99")

# SQLiteC++ 3.x now requires C++11 compiler
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(USE_LATEST_CXX_STANDARD_VERSION "Makes CMake to probe for the latest CXX version. May give efficiency improvements. Disables mandating minimal standard version: CMake has design flaws that prevents from adding a minimal version constraint while opportunistically upgrading: CMAKE_CXX_STANDARD_REQUIRED should have been an int for that, not a boolean" OFF)
if(USE_LATEST_CXX_STANDARD_VERSION)
if(${CMAKE_VERSION} VERSION_GREATER "3.12")
set(CMAKE_CXX_STANDARD 20)
else()
if(${CMAKE_VERSION} VERSION_GREATER "3.8")
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()
endif()
else()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()



message (STATUS "CMake version: ${CMAKE_VERSION}")
message (STATUS "Project version: ${PROJECT_VERSION}")
Expand Down

0 comments on commit 38cbef7

Please sign in to comment.