2023-04-22 14:45:43 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2023-04-21 22:46:18 +02:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
2023-04-22 14:26:37 +02:00
|
|
|
project(ecg_tree)
|
2023-04-21 22:46:18 +02:00
|
|
|
|
2023-05-20 10:49:52 +02:00
|
|
|
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)
|
|
|
|
|
2023-05-20 12:10:36 +02:00
|
|
|
# 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()
|
|
|
|
|
2023-04-22 14:27:08 +02:00
|
|
|
add_library(tree node.cpp)
|
2023-04-21 22:46:18 +02:00
|
|
|
add_executable(main main.cpp)
|
2023-04-22 13:59:08 +02:00
|
|
|
target_link_libraries(main tree)
|
2023-04-21 22:46:18 +02:00
|
|
|
|
|
|
|
find_package(Catch2 3)
|
|
|
|
if(Catch2_FOUND)
|
|
|
|
add_executable(tests tests.cpp)
|
2023-04-22 13:59:08 +02:00
|
|
|
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain tree)
|
2023-04-21 22:46:18 +02:00
|
|
|
|
|
|
|
include(CTest)
|
|
|
|
include(Catch)
|
|
|
|
catch_discover_tests(tests)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
install(TARGETS main)
|
2023-04-22 13:59:08 +02:00
|
|
|
install(TARGETS tree DESTINATION lib)
|