From f88b8e1e0e34f1e25e86468ca271a89af4872eab Mon Sep 17 00:00:00 2001 From: Maksym Mamontov Date: Tue, 28 Jan 2020 19:05:25 +0200 Subject: [PATCH] Lower C++ version, minmal GCC version, compiler-related flags. --- CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 668b0ba3..5b03670a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,10 @@ project ( Stargazer ) set ( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) +if ( CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.2 ) + message ( FATAL_ERROR "Require at least gcc-5.2" ) +endif( CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.2 ) + option ( BUILD_STG "Build Stargazer server." OFF ) option ( BUILD_SGCONF "Build SGConf client." OFF ) option ( BUILD_RSCRIPTD "Build RScriptD server." OFF ) @@ -113,8 +117,13 @@ if ( BUILD_MOD_SMUX OR BUILD_ALL_LIBS ) endif ( BUILD_MOD_SMUX OR BUILD_ALL_LIBS ) enable_language (CXX) -set (CMAKE_CXX_STANDARD 17) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -Wshadow -Wlogical-op -Wuseless-cast -Wno-long-long -Wold-style-cast -Wstrict-aliasing -pedantic") +set (CMAKE_CXX_STANDARD 14) +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -Wshadow -Wno-long-long -Wold-style-cast -Wstrict-aliasing -pedantic") + +if ( CMAKE_COMPILER_IS_GNUCC ) + # GCC-specific + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op -Wuseless-cast") +endif ( CMAKE_COMPILER_IS_GNUCC ) if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) add_definitions ( -DLINUX ) -- 2.44.2