From: Maksym Mamontov Date: Tue, 28 Jan 2020 17:05:25 +0000 (+0200) Subject: Lower C++ version, minmal GCC version, compiler-related flags. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/f88b8e1e0e34f1e25e86468ca271a89af4872eab?hp=bec5d17c77e9cfc8482ffca062b8f500859bfe34 Lower C++ version, minmal GCC version, compiler-related flags. --- 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 )