Skip to content

Commit a967829

Browse files
committed
win: Fix upperilm header generation
clang-cl doesn't recognize "-P -E -x c" compiler arguments, we should use MSVC version of them "/E /TC". Seems clang-cl is not able to handle /P /E together so I only left the necessary one. Fixes: #1192
1 parent 28686b4 commit a967829

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/flang2/utils/upper/CMakeLists.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ add_executable(upperl
1212
# FIXME: Preprocessing and sorting should be part of add_custom_command below.
1313
get_property(cdefs DIRECTORY PROPERTY COMPILE_DEFINITIONS)
1414
list(TRANSFORM cdefs PREPEND "-D")
15-
execute_process(COMMAND "${CMAKE_C_COMPILER}" -E -P -x c ${cdefs} ${UTILS_UPPER_DIR}/upperilm.in
15+
16+
if (NOT MSVC OR "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "GNU")
17+
set(COMPILER_ARGUMENTS -E -P -x c)
18+
else()
19+
set(COMPILER_ARGUMENTS /E /TC)
20+
endif()
21+
22+
execute_process(COMMAND "${CMAKE_C_COMPILER}" ${COMPILER_ARGUMENTS} ${cdefs} ${UTILS_UPPER_DIR}/upperilm.in
1623
WORKING_DIRECTORY ${UTILS_UPPER_BIN_DIR}
1724
RESULT_VARIABLE cpp_result
1825
OUTPUT_VARIABLE cpp_output

0 commit comments

Comments
 (0)