-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFairCMakeModules_test.cmake
60 lines (50 loc) · 1.69 KB
/
FairCMakeModules_test.cmake
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
################################################################################
# Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
cmake_policy(VERSION 3.15...3.20)
if(NOT STEPS)
list(APPEND STEPS clean configure build install test)
endif()
set(CTEST_SOURCE_DIRECTORY .)
set(CTEST_BINARY_DIRECTORY build)
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
get_filename_component(test_install_prefix "${CTEST_BINARY_DIRECTORY}/install"
ABSOLUTE)
if(clean IN_LIST STEPS)
file(REMOVE_RECURSE ${CTEST_BINARY_DIRECTORY})
file(REMOVE_RECURSE ${test_install_prefix})
ctest_start(Continuous)
else()
ctest_start(Continuous APPEND QUIET)
endif()
if(configure IN_LIST STEPS)
list(APPEND options
"-Wdev"
"-Werror=dev"
"-DCMAKE_INSTALL_PREFIX:PATH=${test_install_prefix}"
)
if(DOCS_VERSION)
list(APPEND options "-DDOCS_VERSION=${DOCS_VERSION}")
endif()
ctest_configure(OPTIONS "${options}")
endif()
if(build IN_LIST STEPS)
ctest_build()
endif()
if(docs IN_LIST STEPS)
ctest_build(TARGET docs)
endif()
if(install IN_LIST STEPS)
ctest_build(TARGET install)
endif()
if(test IN_LIST STEPS)
ctest_test(RETURN_VALUE __ret)
if(__ret)
message(FATAL_ERROR "Some tests failed.")
endif()
endif()