From 597e421ba39a7159be5e0a3b3558c845e9205066 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Oct 2025 09:43:56 -0400 Subject: [PATCH] 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 --- Help/envvar/CTEST_PARALLEL_LEVEL.rst | 1 - Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/envvar/CTEST_PARALLEL_LEVEL.rst b/Help/envvar/CTEST_PARALLEL_LEVEL.rst index 798c79b7e0..ba8ae4f3b2 100644 --- a/Help/envvar/CTEST_PARALLEL_LEVEL.rst +++ b/Help/envvar/CTEST_PARALLEL_LEVEL.rst @@ -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``. diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index dd5c005d18..730efa80b2 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -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} "")