-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cmake
More file actions
39 lines (36 loc) · 948 Bytes
/
Copy pathtest.cmake
File metadata and controls
39 lines (36 loc) · 948 Bytes
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
# Copyright (c) 2023, Intercreate, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# Automate CMake configure, build, and test.
#
# Instead of:
#
# cmake -B build && cmake --build build --clean-first && ctest --test-dir build/tests -V
#
# Use:
#
# cmake -P test.cmake
#
execute_process(
COMMAND cmake "-Bbuild"
RESULT_VARIABLE res
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)
if(NOT ${res} STREQUAL "0")
message(FATAL_ERROR "CMake configuration step failed.")
endif()
execute_process(
COMMAND cmake "--build" "build" "--clean-first"
RESULT_VARIABLE res
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)
if(NOT ${res} STREQUAL "0")
message(FATAL_ERROR "CMake build step failed.")
endif()
execute_process(COMMAND ctest "-V" "--test-dir" "build/tests"
RESULT_VARIABLE res
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)
if(NOT ${res} STREQUAL "0")
message(FATAL_ERROR "1 or more tests failed.")
endif()