diff options
author | Sam Clegg <sbc@chromium.org> | 2022-03-18 21:11:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-18 14:11:34 -0700 |
commit | 41a4541e6827129fd93cdc46258f777c844300c4 (patch) | |
tree | b5fb946cc7cdef57237b5ea13578a89040681444 /CMakeLists.txt | |
parent | 4b929da2e3f5fadc4556a223f7d1b38968910c09 (diff) | |
download | wabt-41a4541e6827129fd93cdc46258f777c844300c4.tar.gz wabt-41a4541e6827129fd93cdc46258f777c844300c4.tar.bz2 wabt-41a4541e6827129fd93cdc46258f777c844300c4.zip |
Use CMAKE_CXX_STANDARD and bump cmake minimum version to 3.1 (#1870)
See https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_STANDARD.html
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 40119e06..ed5ecc73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,11 +14,12 @@ # limitations under the License. # -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.1.0) project(WABT LANGUAGES C CXX VERSION 1.0.28) include(GNUInstallDirs) -set(CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) if (POLICY CMP0077) cmake_policy(SET CMP0077 NEW) @@ -131,7 +132,6 @@ 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 @@ -154,7 +154,7 @@ else () ) set(CMAKE_CXX_EXTENSIONS OFF) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++${CXX_STANDARD} -Wold-style-cast") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast") if (NOT WITH_EXCEPTIONS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") @@ -419,8 +419,6 @@ 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 ${CXX_STANDARD}) - set_property(TARGET ${EXE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) if (EMSCRIPTEN) # build to JS for now, as node.js doesn't have code caching for wasm yet, |