X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8e80bb9cec2c90dd61f810fb1525932a434288eb..1c529746ff07312e30e76fd933c628c658e3c77d:/CMakeLists.txt?ds=inline diff --git a/CMakeLists.txt b/CMakeLists.txt index 30deed57..7e8fd09a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,6 @@ project ( Stargazer ) set ( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) -if ( CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.5 ) - message ( FATAL_ERROR "Require at least gcc-6.5" ) -endif( CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.5 ) - option ( BUILD_STG "Build Stargazer server." OFF ) option ( BUILD_SGCONF "Build SGConf client." OFF ) option ( BUILD_RSCRIPTD "Build RScriptD server." OFF ) @@ -98,15 +94,49 @@ if ( BUILD_MOD_STORE_FIREBIRD OR BUILD_ALL_LIBS ) endif ( BUILD_MOD_STORE_FIREBIRD OR BUILD_ALL_LIBS ) if ( BUILD_MOD_PING OR BUILD_ALL_LIBS ) - set ( BUILD_LIB_PINGER ON ) + set ( BUILD_LIB_PINGER ON ) endif ( BUILD_MOD_PING OR BUILD_ALL_LIBS ) if ( BUILD_MOD_SMUX OR BUILD_ALL_LIBS ) set ( BUILD_LIB_SMUX ON ) endif ( BUILD_MOD_SMUX OR BUILD_ALL_LIBS ) +if ( TIDY ) + find_program( CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" ) + if ( NOT CLANG_TIDY_EXE ) + message( STATUS "clang-tidy not found." ) + else () + message( STATUS "clang-tidy found: ${CLANG_TIDY_EXE}" ) + set( DO_CLANG_TIDY "${CLANG_TIDY_EXE}" + "-checks=-*,\ +clang-analyzer-*,\ +misc-*,\ +modernize-*,\ +performance-*,\ +portability-*,\ +readability-*,\ +bugprone-*,\ +-modernize-avoid-bind,\ +-modernize-use-trailing-return-type,\ +-readability-braces-around-statements, \ +-readability-magic-numbers, \ +-readability-identifier-length, \ +-bugprone-easily-swappable-parameters" ) + endif () +endif () + +if ( IWYU ) + find_program( INCLUDE_WHAT_YOU_USE_EXE NAMES "include-what-you-use" DOC "Path to include-what-you-use executable" ) + if ( NOT INCLUDE_WHAT_YOU_USE_EXE ) + message( STATUS "include-what-you-use not found." ) + else () + message( STATUS "include-what-you-use found: ${INCLUDE_WHAT_YOU_USE_EXE}" ) + set( DO_INCLUDE_WHAT_YOU_USE "${INCLUDE_WHAT_YOU_USE_EXE}" ) + endif () +endif () + enable_language (CXX) -set (CMAKE_CXX_STANDARD 14) +set (CMAKE_CXX_STANDARD 17) 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 ) @@ -134,17 +164,19 @@ elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" ) elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" ) add_definitions ( -DDARWIN ) if ( BUILD_LIB_IBPP ) - add_definitions ( -DIBPP_DARWIN ) + add_definitions ( -DIBPP_DARWIN ) endif ( BUILD_LIB_IBPP ) else () message ( WARNING "Unsupported system: '${CMAKE_SYSTEM_NAME}'" ) endif () include_directories ( include ) +include_directories ( 3rdparty/jthread/source ) add_subdirectory ( libs ) add_subdirectory ( projects ) if ( BUILD_TESTS ) + enable_testing () add_subdirectory ( tests ) endif ( BUILD_TESTS )