2019-04-03 21:21:22 +02:00
|
|
|
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
|
|
|
project (libtree++ VERSION 0.1.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
|
2023-07-26 10:13:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set the required C++ standard
|
|
|
|
#
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
|
|
|
#
|
|
|
|
# We want to have a compile_commands.json file
|
|
|
|
#
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Module includes for compdb and doxygen
|
|
|
|
#
|
|
|
|
include(compdb)
|
|
|
|
include(doxygen)
|
|
|
|
|
2019-04-03 21:21:22 +02:00
|
|
|
|
|
|
|
configure_file(${PROJECT_SOURCE_DIR}/src/config.hpp.in ${PROJECT_SOURCE_DIR}/src/config.hpp @ONLY)
|
|
|
|
|
|
|
|
|
|
|
|
set(generated "${PROJECT_SOURCE_DIR}/src/config.hpp")
|
|
|
|
|
|
|
|
add_custom_target(clean-generated COMMAND rm -f ${generated})
|
|
|
|
|
|
|
|
add_library(tree STATIC
|
|
|
|
src/config.hpp
|
|
|
|
include/Tree/tree.hpp
|
|
|
|
src/Tree/tree.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(tree PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
PRIVATE src
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Everything TEST related
|
|
|
|
#
|
2023-07-26 10:13:27 +02:00
|
|
|
option(TEST_TREE "Turn running of tree specific tests on/off" ON)
|
2022-07-09 13:54:02 +02:00
|
|
|
|
|
|
|
IF(${TEST_TREE})
|
|
|
|
enable_testing()
|
|
|
|
message(STATUS "Tree tests enabled")
|
2024-01-28 22:45:55 +01:00
|
|
|
|
|
|
|
IF(NOT TARGET Catch2)
|
|
|
|
add_subdirectory(libs/Catch2 EXCLUDE_FROM_ALL)
|
|
|
|
include(libs/Catch2/extras/Catch.cmake)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
2022-07-09 13:54:02 +02:00
|
|
|
include(CTest)
|
|
|
|
ELSE()
|
|
|
|
message(STATUS "Tree tests disabled")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF (${TEST_TREE})
|
2019-04-03 21:21:22 +02:00
|
|
|
|
2024-01-28 22:45:55 +01:00
|
|
|
add_executable(test_base tests/test_base.cpp)
|
|
|
|
target_link_libraries(test_base Catch2WithMain tree)
|
|
|
|
catch_discover_tests(test_base)
|
2019-04-03 21:21:22 +02:00
|
|
|
|
2022-07-09 13:54:02 +02:00
|
|
|
|
|
|
|
ENDIF()
|