On Tue, Jul 21, 2026 at 4:33 PM <[email protected]> wrote:

> Author: jun66j5
> Date: Tue Jul 21 14:33:38 2026
> New Revision: 1936422
>
> Log:
> cmake: Follow-up to r1936349, restore the minimum version of cmake to
> `3.14`.
>
> * CMakeLists.txt
>   (cmake_minimum_required):
>     Ditto.
>   (test_prepend_builddir_to_path):
>     Add function to prepend the build directory to PATH environment.
>     If cmake version is 3.22 or later, use `ENVIRONMENT_MODIFICATION` with
>     `path_list_prepend` simply.  Otherwise, build the value and use
>     `ENVIRONMENT`.
>   (swig-perl, swig-python, swig-ruby):
>     Use `test_prepend_builddir_to_path()` instead of
> `ENVIRONMENT_MODIFICATION`
>     directly.
>
> Modified:
>    subversion/trunk/CMakeLists.txt
>
> Modified: subversion/trunk/CMakeLists.txt
>
> ==============================================================================
> --- subversion/trunk/CMakeLists.txt     Tue Jul 21 12:45:05 2026
> (r1936421)
> +++ subversion/trunk/CMakeLists.txt     Tue Jul 21 14:33:38 2026
> (r1936422)
> @@ -21,7 +21,7 @@
>
>  # CMAKE_MINIMUM_REQUIRED should be the first directive in the file:
>  # https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html
> -cmake_minimum_required(VERSION 3.22)
> +cmake_minimum_required(VERSION 3.14)
>
>  # CMP0092: MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.
>  if(POLICY CMP0092)
> @@ -861,6 +861,23 @@ function(swig_target_external_runtime ta
>    target_sources(${target} INTERFACE ${swig_runtime_path})
>  endfunction()
>
> +function(test_prepend_builddir_to_path name)
> +  file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" dir)
> +  if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.22")
> +    set_property(TEST ${name} APPEND PROPERTY ENVIRONMENT_MODIFICATION
> +      "PATH=path_list_prepend:${dir}"
> +    )
> +  else()
> +    if(WIN32)
> +      # Replace <;> with <\;> to prevent conversion to a list
> +      string(REPLACE ";" "\\;" value "PATH=${dir};$ENV{PATH}")
> +    else()
> +      set(value "PATH=${dir}:$ENV{PATH}")
> +    endif()
> +    set_property(TEST ${name} APPEND PROPERTY ENVIRONMENT "${value}")
> +  endif()
> +endfunction()
> +
>  if(SVN_ENABLE_SWIG_PYTHON)
>    find_package(PY3C REQUIRED)
>
> @@ -920,9 +937,7 @@ if(SVN_ENABLE_SWIG_PYTHON)
>        "${CMAKE_CURRENT_BINARY_DIR}/swig-python"
>    )
>    if(WIN32 OR CYGWIN)
> -    set_property(TEST swig-python APPEND PROPERTY ENVIRONMENT_MODIFICATION
> -      "PATH=path_list_prepend:$<SHELL_PATH:${CMAKE_CURRENT_BINARY_DIR}>"
> -    )
> +    test_prepend_builddir_to_path(swig-python)
>    endif()
>  endif()
>
> @@ -1001,9 +1016,7 @@ if(SVN_ENABLE_SWIG_PERL)
>        ${CMAKE_CURRENT_SOURCE_DIR}/subversion/bindings/swig/perl/native
>    )
>    if(WIN32 OR CYGWIN)
> -    set_property(TEST swig-perl APPEND PROPERTY ENVIRONMENT_MODIFICATION
> -      "PATH=path_list_prepend:$<SHELL_PATH:${CMAKE_CURRENT_BINARY_DIR}>"
> -    )
> +    test_prepend_builddir_to_path(swig-perl)
>    endif()
>  endif()
>
> @@ -1053,9 +1066,7 @@ if(SVN_ENABLE_SWIG_RUBY)
>      "SVN_TEST_SWIG_RUBY=ctest"
>    )
>    # svnserve in the build directory is launched by the tests
> -  set_property(TEST swig-ruby APPEND PROPERTY ENVIRONMENT_MODIFICATION
> -    "PATH=path_list_prepend:$<SHELL_PATH:${CMAKE_CURRENT_BINARY_DIR}>"
> -  )
> +  test_prepend_builddir_to_path(swig-ruby)
>  endif()
>
>  ### Checks
>
>
I think here you've changed the behaviour by using the configure time
environment instead of the one when tests are run (which I
assume ENVIRONMENT_MODIFICATION does). This is not mentioned in the log
message.

Btw, did you consider simply requiring more modern cmake when swig bindings
are enabled? I remember before we bumped to 3.14 from 3.12 there was logic
to still force cmake 3.14/3.13 (I don't remember the exact version) for the
bindings. The default config should not be affected by this but the
bindings (I assume a lot of consumers don't compile them) - in this case
they will have to get a newer cmake.

-- 
Timofei Zhakov

Reply via email to