@@ -33,6 +33,10 @@ if(CMakePythonDistributions_SUPERBUILD)
3333
3434 option (BUILD_VERBOSE "Build reporting additional information (e.g download progress, ...)" ON )
3535
36+ option (RUN_CMAKE_TEST "Run CMake test suite when built from sources" ON )
37+
38+ set (RUN_CMAKE_TEST_EXCLUDE "BootstrapTest" CACHE STRING "CMake test suite exclusion regex" )
39+
3640 set (CMakePythonDistributions_ARCHIVE_DOWNLOAD_DIR "${CMAKE_BINARY_DIR} "
3741 CACHE PATH "Directory where to download archives"
3842 )
@@ -311,15 +315,17 @@ set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\
311315 )
312316 set (CMAKEPROJECT_BUILD_LAST_STEP "strip_executables" )
313317 endif ()
314- # TODO probably want to make this conditional
315- ExternalProject_Add_Step(CMakeProject-build run_cmake_test_suite
316- DEPENDEES ${CMAKEPROJECT_BUILD_LAST_STEP}
317- COMMENT "Running CMake test suite"
318- COMMAND ./bin/ctest --force-new-ctest-process --stop-on -failure --output -on -failure -j2 -E BootstrapTest
319- WORKING_DIRECTORY ${CMakeProject_BINARY_DIR}
320- USES_TERMINAL 1
321- )
322- set (CMAKEPROJECT_BUILD_LAST_STEP "run_cmake_test_suite" )
318+
319+ if (RUN_CMAKE_TEST)
320+ ExternalProject_Add_Step(CMakeProject-build run_cmake_test_suite
321+ DEPENDEES ${CMAKEPROJECT_BUILD_LAST_STEP}
322+ COMMENT "Running CMake test suite, exclusion list: '${RUN_CMAKE_TEST_EXCLUDE} '"
323+ COMMAND ./bin/ctest --force-new-ctest-process --stop-on -failure --output -on -failure -j2 -E ${RUN_CMAKE_TEST_EXCLUDE}
324+ WORKING_DIRECTORY ${CMakeProject_BINARY_DIR}
325+ USES_TERMINAL 1
326+ )
327+ set (CMAKEPROJECT_BUILD_LAST_STEP "run_cmake_test_suite" )
328+ endif ()
323329 else ()
324330 cpd_ExternalProject_Add_Empty(CMakeProject-build "CMakeProject-src-download" )
325331 endif ()
0 commit comments