From 67cf2a5abdb01658c1cf852b29e25808dcc02c56 Mon Sep 17 00:00:00 2001 From: Nicholas Guriev Date: Wed, 22 Jan 2020 08:13:56 +0300 Subject: [PATCH] Use C++17 as maximum standard for GCC GCC 9 has incomplete and buggy implementation of -std=c++2a. Rollback to c++17. --- init_target.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index c549f38..62f599e 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -4,6 +4,11 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL +set(MAXIMUM_CXX_STANDARD cxx_std_20) +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(MAXIMUM_CXX_STANDARD cxx_std_17) +endif() + function(init_target_folder target_name folder_name) if (NOT "${folder_name}" STREQUAL "") set_target_properties(${target_name} PROPERTIES FOLDER ${folder_name}) @@ -15,11 +20,11 @@ function(init_target target_name) # init_target(my_target folder_name) if (${ARGV1} STREQUAL cxx_std_14 OR ${ARGV1} STREQUAL cxx_std_11) target_compile_features(${target_name} PUBLIC ${ARGV1}) else() - target_compile_features(${target_name} PUBLIC cxx_std_20) + target_compile_features(${target_name} PUBLIC ${MAXIMUM_CXX_STANDARD}) init_target_folder(${target_name} ${ARGV1}) endif() else() - target_compile_features(${target_name} PUBLIC cxx_std_20) + target_compile_features(${target_name} PUBLIC ${MAXIMUM_CXX_STANDARD}) endif() if (WIN32) set_target_properties(${target_name} PROPERTIES