summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2022-02-11 09:41:49 -0800
committerGitHub <noreply@github.com>2022-02-11 09:41:49 -0800
commit789dc0857ea13e286e03085855f54366fa9f1d5c (patch)
treec1ba8548d117a0f920414ea994bb06c9056e06ef /CMakeLists.txt
parent11ed776f627535b4e851fcebfd52276de668f3f3 (diff)
downloadwabt-789dc0857ea13e286e03085855f54366fa9f1d5c.tar.gz
wabt-789dc0857ea13e286e03085855f54366fa9f1d5c.tar.bz2
wabt-789dc0857ea13e286e03085855f54366fa9f1d5c.zip
Move to C++17 (#1825)
Fixes: #1811
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2d67da81..84c57336 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,9 +15,11 @@
#
cmake_minimum_required(VERSION 3.0.0)
-project(WABT VERSION 1.0.26)
+project(WABT LANGUAGES C CXX VERSION 1.0.26)
include(GNUInstallDirs)
+set(CXX_STANDARD 17)
+
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
@@ -125,6 +127,7 @@ if (COMPILER_IS_MSVC)
# disable warnings C4267 and C4244: conversion/truncation from larger to smaller type.
# disable warning C4800: implicit conversion from larger int to bool
add_definitions(-W3 -wd4018 -wd4056 -wd4756 -wd4267 -wd4244 -wd4800 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
+ add_definitions(/std:c++${CXX_STANDARD})
if (NOT WITH_EXCEPTIONS)
# disable exception use in C++ library
@@ -143,7 +146,7 @@ else ()
)
set(CMAKE_CXX_EXTENSIONS OFF)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wold-style-cast")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++${CXX_STANDARD} -Wold-style-cast")
if (NOT WITH_EXCEPTIONS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
@@ -415,7 +418,7 @@ function(wabt_executable)
add_executable(${EXE_NAME} ${EXE_SOURCES})
add_dependencies(everything ${EXE_NAME})
target_link_libraries(${EXE_NAME} ${EXE_LIBS})
- set_property(TARGET ${EXE_NAME} PROPERTY CXX_STANDARD 11)
+ set_property(TARGET ${EXE_NAME} PROPERTY CXX_STANDARD ${CXX_STANDARD})
set_property(TARGET ${EXE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
if (EMSCRIPTEN)