66 lines
2.1 KiB
CMake
66 lines
2.1 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/scc/cmake)
|
|
cmake_policy(SET CMP0110 NEW)
|
|
|
|
project(SCC_Test)
|
|
|
|
option(FULL_TEST_SUITE "enable also long-running tests" OFF)
|
|
option(ENABLE_SCV "Enable use of SCV" OFF)
|
|
option(ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF)
|
|
|
|
include(GNUInstallDirs)
|
|
include(BuildType)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
set(warnings "-Wall -Wextra -Werror")
|
|
set(CMAKE_CXX_FLAG_RELEASE "-O3 -DNDEBUG")
|
|
set(CMAKE_C_FLAG_RELEASE "-O3 -DNDEBUG")
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
set(warnings "/W4 /WX /EHsc")
|
|
endif()
|
|
|
|
if(ENABLE_COVERAGE)
|
|
include(CodeCoverage)
|
|
append_coverage_compiler_flags()
|
|
endif()
|
|
|
|
if(ENABLE_CLANG_TIDY)
|
|
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
|
|
if(CLANG_TIDY_EXE)
|
|
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
|
|
#set(CLANG_TIDY_CHECKS "-*,modernize-*,-modernize-use-trailing-return-type,clang-analyzer-core.*,clang-analyzer-cplusplus.*")
|
|
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE};-fix)
|
|
else()
|
|
message(AUTHOR_WARNING "clang-tidy not found!")
|
|
set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it
|
|
endif()
|
|
endif()
|
|
|
|
set(CLANG_FORMAT_EXCLUDE_PATTERNS "/third_party/" "/build/")
|
|
find_package(ClangFormat)
|
|
find_package(ZLIB)
|
|
find_package(lz4)
|
|
# This line finds the boost lib and headers.
|
|
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
|
|
find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED)
|
|
find_package(fmt REQUIRED)
|
|
find_package(spdlog REQUIRED)
|
|
find_package(Catch2)
|
|
|
|
include(SystemCPackage)
|
|
include(CTest)
|
|
include(Catch)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(scc)
|
|
add_subdirectory(src)
|
|
add_subdirectory(tests)
|