1010import argparse
1111import enum
1212import os
13+ import posixpath
1314import re
1415import sys
1516import textwrap
@@ -256,7 +257,9 @@ def generate_header_files(branch_data: BranchData,
256257 """Generate the header files to include before and after *config.h."""
257258 for position in Position :
258259 generator = HeaderGenerator (branch_data , position )
259- yield os .path .join (directory , generator .output_file_name ())
260+ # Make sure to output a path with / even on Windows, so that
261+ # it can be consumed by tools such as CMake.
262+ yield posixpath .join (directory , generator .output_file_name ())
260263 if not list_only :
261264 generator .write (directory )
262265
@@ -280,7 +283,7 @@ def main(branch_data: BranchData) -> None:
280283 parser .add_argument ('--list-for-cmake' , action = 'store_true' ,
281284 help = 'List generated files in CMake-friendly format and exit' )
282285 parser .add_argument ('output_directory' , metavar = 'DIR' , nargs = '?' ,
283- default = os . path .join (root , branch_data .header_directory ),
286+ default = posixpath .join (root , branch_data .header_directory ),
284287 help = 'output file location (default: %(default)s)' )
285288 options = parser .parse_args ()
286289 list_only = options .list or options .list_for_cmake
0 commit comments