Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f176ff

Browse files
committed
py/mkrules: fix pipe command failure on windows.
Piped commands fail when forward slash is used with executable. For example: `echo a | C:/gcc/bin/gcc.exe` fails with the following error: 'C:' is not recognized as an internal or external command, operable program or batch file. Converting path to backslash avoids the error. Signed-off-by: Georgij Cernysiov <[email protected]>
1 parent 869fdb1 commit 5f176ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

py/mkrules.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ set(MICROPY_ROOT_POINTERS_COLLECTED "${MICROPY_GENHDR_DIR}/root_pointers.collect
1616
set(MICROPY_ROOT_POINTERS "${MICROPY_GENHDR_DIR}/root_pointers.h")
1717

1818
if(CMAKE_HOST_WIN32)
19+
# On Windows piped commands fail when forward slash is used with executable.
20+
#
21+
# For example: `echo a | C:/gcc/bin/gcc.exe` fails with the following error:
22+
# 'C:' is not recognized as an internal or external command, operable program or batch file.
23+
# Converting path to backslash avoids the error.
24+
string(REGEX REPLACE "/" "\\\\" CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
1925
# CMD requires additional escapes for CMD
2026
set(MICROPY_QSTRDEFS_PREPROCESS_SED0 "s/^^Q(.*)/\"^&\"/")
2127
set(MICROPY_QSTRDEFS_PREPROCESS_SED1 "s/^^\\\"\\(Q(.*)\\)\\\"/\\1/")

0 commit comments

Comments
 (0)