CMP0236ΒΆ

Added in version 4.6.

separate_arguments() and get_filename_component() PROGRAM splitting works on Windows.

In CMake 4.5 and below these commands did not handle Windows command-line syntax:

  • The separate_arguments() command's PROGRAM splitting operation, when invoked without SEPARATE_ARGS, always parsed the input as a UNIX_COMMAND with POSIX shell syntax, even when the input had Windows command-line syntax:

    separate_arguments(output WINDOWS_COMMAND PROGRAM "${input}")
    

    or on Windows hosts:

    separate_arguments(output NATIVE_COMMAND PROGRAM "${input}")
    
  • The get_filename_component() command's PROGRAM splitting operation always parsed the input as POSIX shell syntax, even on Windows:

    get_filename_component(output "${input}" PROGRAM)
    

    or:

    get_filename_component(output "${input}" PROGRAM PROGRAM_ARGS args)
    

CMake 4.6 and above prefer to parse as Windows command-line syntax when appropriate. This policy provides compatibility with projects that may have worked around these bugs by modifying their input to the commands.

The OLD behavior for this policy is for both commands to always parse input as POSIX shell syntax. The NEW behavior for this policy is for separate_arguments to parse as a WINDOWS_COMMAND when specified, and for get_filename_component to parse natively on each platform.

This policy was introduced in CMake version 4.6. It may be set by cmake_policy() or cmake_minimum_required(). If it is not set, CMake does not warn, and uses OLD behavior.

Note

The OLD behavior of a policy is deprecated by definition and may be removed in a future version of CMake.