Skip to content

Commit 73622aa

Browse files
committed
Remove the add_test hook to generate tests the same on all platforms
1 parent 69d844a commit 73622aa

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

cmake/generate_documentation.cmake

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
option(CMKR_GENERATE_DOCUMENTATION "Generate cmkr documentation" ${CMKR_ROOT_PROJECT})
2-
set(CMKR_TESTS "" CACHE INTERNAL "List of test directories in the order declared in tests/cmake.toml")
3-
4-
if(CMKR_GENERATE_DOCUMENTATION)
5-
# Hook the add_test function to capture the tests in the order declared in tests/cmake.toml
6-
function(add_test)
7-
cmake_parse_arguments(TEST "" "WORKING_DIRECTORY" "" ${ARGN})
8-
get_filename_component(TEST_WORKING_DIRECTORY "${TEST_WORKING_DIRECTORY}" NAME)
9-
list(APPEND CMKR_TESTS "${TEST_WORKING_DIRECTORY}")
10-
set(CMKR_TESTS "${CMKR_TESTS}" CACHE INTERNAL "")
11-
_add_test(${test} ${ARGN})
12-
endfunction()
13-
endif()
142

153
function(generate_documentation)
164
if(CMKR_GENERATE_DOCUMENTATION)
175
message(STATUS "[cmkr] Generating documentation...")
6+
7+
# Extract the order of the tests
8+
set(CMKR_TESTS "")
9+
file(READ "${PROJECT_SOURCE_DIR}/tests/cmake.toml" tests_toml NO_HEX_CONVERSION)
10+
string(REGEX MATCHALL "working-directory = \"([^\"]+)\"" tests_match "${tests_toml}")
11+
foreach(match ${tests_match})
12+
if(match MATCHES "working-directory = \"([^\"]+)\"")
13+
list(APPEND CMKR_TESTS "${CMAKE_MATCH_1}")
14+
else()
15+
message(FATAL_ERROR "This should not happen (wrong regex?)")
16+
endif()
17+
endforeach()
1818

1919
# Delete previously generated examples
2020
set(example_folder "${PROJECT_SOURCE_DIR}/docs/examples")

0 commit comments

Comments
 (0)