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 <kc8apf@kc8apf.net>
Signed-off-by: Tim 'mithro' Ansell <mithro@mithis.com>
This commit is contained in:
Rick Altherr 2017-12-01 08:59:42 -08:00 committed by Tim 'mithro' Ansell
parent f65ee46f7c
commit 6a4402415e
1 changed files with 2 additions and 1 deletions

View File

@ -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)