SystemC-Components-Test/CMakeLists.txt

66 lines
2.1 KiB
CMake
Raw Normal View History

2022-10-02 18:20:00 +02:00
cmake_minimum_required(VERSION 3.16)
2022-09-30 15:21:01 +02:00
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/scc/cmake)
2022-10-02 21:40:19 +02:00
cmake_policy(SET CMP0110 NEW)
2020-06-04 09:46:46 +02:00
project(SCC_Test)
2022-10-02 18:20:00 +02:00
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)
2020-06-04 09:46:46 +02:00
2022-09-30 15:21:01 +02:00
include(GNUInstallDirs)
2020-06-04 09:46:46 +02:00
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)
2024-07-06 10:07:51 +02:00
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
2023-12-22 20:42:21 +01:00
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()
2020-06-04 09:46:46 +02:00
2024-12-18 19:23:05 +01:00
set(CLANG_FORMAT_EXCLUDE_PATTERNS "/third_party/" "/build/")
2023-12-22 20:42:21 +01:00
find_package(ClangFormat)
find_package(ZLIB)
2022-10-02 11:39:06 +02:00
find_package(lz4)
2020-06-04 09:46:46 +02:00
# 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)
2023-01-05 15:31:07 +01:00
find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)
find_package(Catch2)
2022-09-30 15:21:01 +02:00
include(SystemCPackage)
2022-10-02 21:40:19 +02:00
include(CTest)
include(Catch)
2020-06-04 09:46:46 +02:00
enable_testing()
2021-06-01 18:08:32 +02:00
add_subdirectory(scc)
add_subdirectory(src)
2020-06-04 09:46:46 +02:00
add_subdirectory(tests)