From 6a4402415e7bb37fa1695e9d122841c42651c221 Mon Sep 17 00:00:00 2001 From: Rick Altherr Date: Fri, 1 Dec 2017 08:59:42 -0800 Subject: [PATCH] Use proper CMake mechanisms to set compiler settings By setting CMAKE_CXX_STANDARD, CMake will figure out the right flag to pass to the compiler being used as well as error if the compiler doesn't support that standard. The standard can also be changed on a per-target basis. Using add_compiler_options() is just a bit cleaner syntactically and will apply the flags to C and C++. Signed-off-by: Rick Altherr Signed-off-by: Tim 'mithro' Ansell --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fd4665c..0d59d4bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.5.0) project(prjxray) option(PRJXRAY_BUILD_TESTING "" ON) -set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror ${CMAKE_CXX_FLAGS}" ) +set(CMAKE_CXX_STANDARD 14) +add_compile_options(-Wall -Werror) # Hack for missing option in cctz option(BUILD_TESTING "" OFF)