Skip to content

Commit 2afd3a1

Browse files
committed
Added option to enable modern C++ versions.
1 parent 3f0ec28 commit 2afd3a1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ project(dbc VERSION 0.5.0 DESCRIPTION "C++ DBC Parser")
55

66
# -- PROJECT OPTIONS -- #
77
option(DBC_ENABLE_TESTS "Enable Unittests" ON)
8+
option(DBC_MODERN_CPP "Enable support for modern C++" OFF)
89
option(DBC_TEST_LOCALE_INDEPENDENCE "Used to deterime if the libary is locale agnostic when it comes to converting floats. You need `de_DE.UTF-8` locale installed for this testing." OFF)
910
option(DBC_GENERATE_DOCS "Use doxygen if installed to generated documentation files" OFF)
1011
option(DBC_GENERATE_SINGLE_HEADER "This will run the generator for the single header file version. Default is OFF since we make a static build. Requires cargo installed." OFF)
@@ -21,8 +22,13 @@ set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
2122
include(CPack)
2223

2324
# specify the C++ standard
24-
set(CMAKE_CXX_STANDARD 11)
25-
set(CMAKE_CXX_STANDARD_REQUIRED True)
25+
if (DBC_ENABLE_TESTS OR DBC_MODERN_CPP)
26+
set(CMAKE_CXX_STANDARD 17)
27+
set(CMAKE_CXX_STANDARD_REQUIRED True)
28+
else()
29+
set(CMAKE_CXX_STANDARD 11)
30+
set(CMAKE_CXX_STANDARD_REQUIRED True)
31+
endif()
2632

2733
find_package(FastFloat QUIET)
2834
if (NOT ${FastFloat_FOUND})

0 commit comments

Comments
 (0)