31 lines
850 B
CMake
31 lines
850 B
CMake
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
cmake_minimum_required(VERSION 3.20)
|
|
project(ecg_tree)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
# Disable compiler specific extensions
|
|
# On GNU this has the effect of passing -std=c++11 instead of -std=gnu++11
|
|
set(CMAKE_CXX_EXTENSIONS no)
|
|
|
|
# Enable all compiler warnings (and make them errors) on GNU/Clang platforms
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang)$")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror")
|
|
endif()
|
|
|
|
add_library(tree node.cpp)
|
|
add_executable(main main.cpp)
|
|
target_link_libraries(main tree)
|
|
|
|
find_package(Catch2 3)
|
|
if(Catch2_FOUND)
|
|
add_executable(tests tests.cpp)
|
|
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain tree)
|
|
|
|
include(CTest)
|
|
include(Catch)
|
|
catch_discover_tests(tests)
|
|
endif()
|
|
|
|
install(TARGETS main)
|
|
install(TARGETS tree DESTINATION lib)
|