Skip to content

Commit e472e80

Browse files
willcl-arkgithub-actions[bot]
authored andcommitted
cmake: add an example test script
1 parent 7beeb36 commit e472e80

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

CTestScript.cmake.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cmake_host_system_information(RESULT HOST_NAME QUERY HOSTNAME)
2+
3+
include(ProcessorCount)
4+
ProcessorCount(n)
5+
if(NOT n EQUAL 0)
6+
set(CTEST_BUILD_FLAGS -j${n})
7+
set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${n})
8+
endif()
9+
10+
set( CTEST_SITE ${HOST_NAME})
11+
set(CTEST_BUILD_NAME "macOS")
12+
set( CTEST_SOURCE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" )
13+
set( CTEST_BINARY_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/build")
14+
set(CTEST_CMAKE_GENERATOR "Ninja")
15+
16+
# Optionally, set files to upload as "NOTES" for the build
17+
set(CTEST_NOTES_FILES "${CTEST_SOURCE_DIRECTORY}/CMakeLists.txt")
18+
19+
# ctest_start will take the name of the mode like the
20+
# -D command does
21+
ctest_start("Experimental")
22+
23+
# Attempt to pull updates from version control
24+
# ctest_update()
25+
26+
# Executes the Configure/Generate step
27+
ctest_configure(
28+
BUILD ${CTEST_BINARY_DIRECTORY}
29+
SOURCE ${CTEST_SOURCE_DIRECTORY}
30+
)
31+
32+
# Execute the build step to capture build information
33+
ctest_build(BUILD ${CTEST_BINARY_DIRECTORY})
34+
35+
# Executing ctest command
36+
ctest_test(${ctest_test_args})
37+
38+
# Submit Files to CDash
39+
ctest_submit()

0 commit comments

Comments
 (0)