1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Help: Remove incorrect Windows env var limitation from CTEST_PARALLEL_LEVEL

In commit 5de1e21659 (ctest: Allow passing -j without value to choose a
contextual default, 2024-03-06, v3.29.0-rc4~10^2) I misdiagnosed the
reason that the test could not set an empty environment variable on
Windows.  It is actually a limitation of `set(ENV{VAR})` inherited from
its implementation using `_wputenv`.  Process environment blocks can
contain empty environment variables.

Issue: #27285
This commit is contained in:
Brad King
2025-10-09 09:43:56 -04:00
parent 32689113d7
commit 597e421ba3
2 changed files with 1 additions and 1 deletions

View File

@@ -14,7 +14,6 @@ up to 8 tests concurrently as if ``ctest`` were invoked with the
parallelism, or unbounded parallelism, respectively, as documented by
the :option:`ctest --parallel` option.
On Windows, environment variables cannot be set to an empty string.
CTest will interpret a whitespace-only string as empty.
In CMake 3.28 and earlier, an empty or ``0`` value was equivalent to ``1``.

View File

@@ -63,6 +63,7 @@ run_ctest_test(Parallel4 INCLUDE test PARALLEL_LEVEL 4)
set(ENV{CTEST_PARALLEL_LEVEL} bad)
run_ctest_test(ParallelEnvBad INCLUDE test)
if(CMAKE_HOST_WIN32)
# FIXME(#27285): `set(ENV{VAR} "")` unsets VAR on Windows.
set(ENV{CTEST_PARALLEL_LEVEL} " ")
else()
set(ENV{CTEST_PARALLEL_LEVEL} "")