Don't override CTEST_PARALLEL_LEVEL env variable

I think the dynamic detection patch ends up overriding the environment variable
set by CI (if present), because `if(NOT CTEST_PARALLEL_LEVEL)` would define to
false even if an environment variable of that name existed then we end up
explicitly assigning the environment variable by that name upon invocation with
`env`.
This commit is contained in:
Mahmoud Al-Qudsi 2025-01-10 19:16:32 -06:00
parent 1f45ab63d1
commit a4f91a8543

View file

@ -2,10 +2,14 @@
enable_testing()
# By default, ctest runs tests serially
# Support CTEST_PARALLEL_LEVEL as an environment variable in addition to a CMake variable
if(NOT CTEST_PARALLEL_LEVEL)
include(ProcessorCount)
ProcessorCount(CORES)
set(CTEST_PARALLEL_LEVEL ${CORES})
set(CTEST_PARALLEL_LEVEL $ENV{CTEST_PARALLEL_LEVEL})
if(NOT CTEST_PARALLEL_LEVEL)
include(ProcessorCount)
ProcessorCount(CORES)
set(CTEST_PARALLEL_LEVEL ${CORES})
endif()
endif()