From e0c99a8dd6b2188bf368031a8ce95b06b84ec13d Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Thu, 27 Mar 2025 13:16:44 -0700 Subject: [PATCH] By default, run ctests on all available cores in parallel. --- cmake/EigenConfigureTesting.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/EigenConfigureTesting.cmake b/cmake/EigenConfigureTesting.cmake index 2a1e7ab5a..eecef2386 100644 --- a/cmake/EigenConfigureTesting.cmake +++ b/cmake/EigenConfigureTesting.cmake @@ -1,6 +1,7 @@ include(EigenTesting) include(CheckCXXSourceCompiles) + # configure the "site" and "buildname" ei_set_sitename() @@ -8,7 +9,17 @@ ei_set_sitename() ei_set_build_string() add_custom_target(buildtests) + +if (NOT EIGEN_CTEST_ARGS) + # By default, run tests in parallel on all available cores. + include(ProcessorCount) + ProcessorCount(NPROC) + if(NOT NPROC EQUAL 0) + set(EIGEN_CTEST_ARGS "" CACHE STRING "-j"${NPROC}) + endif() +endif() add_custom_target(check COMMAND "ctest" ${EIGEN_CTEST_ARGS}) + add_dependencies(check buildtests) # Convenience target for only building GPU tests.