-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
40 lines (33 loc) · 1.43 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# SPDX-FileCopyrightText: 2006-2024, Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2024, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause
# This file is called in the following scenarios
# 1. scenario: this file is at the root of a `cmake ..` call.
# In this case we assume this project is compiled for packaging or testing.
# 2. scenario: another project is adding this directory via "find_package (TDL REQUIRED PATHS lib/tool_description_lib)".
# In this case we don't want any tests to be included.
cmake_minimum_required (VERSION 3.15)
# check if this is the root project (
if (NOT DEFINED PROJECT_NAME)
set (CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use")
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
set (TDL_ROOT_PROJECT TRUE)
endif ()
include (cmake/version.cmake)
project (tdl
LANGUAGES CXX
VERSION "${TDL_VERSION}"
DESCRIPTION "tdl -- tool description library")
include (cmake/configuration.cmake)
# Enable and include testing if this is a root directory
if (${TDL_ROOT_PROJECT})
enable_testing ()
file (GLOB TEST_CPP_FILES
LIST_DIRECTORIES false
RELATIVE ${tdl_SOURCE_DIR}
CONFIGURE_DEPENDS src/test_tdl/*.cpp)
add_executable (test_tdl ${TEST_CPP_FILES})
target_link_libraries (test_tdl tdl::tdl)
add_test (NAME test_tdl COMMAND test_tdl)
endif ()