Skip to content

Commit 65aaa7f

Browse files
Enable fallbacks on Windows
1 parent e03f42a commit 65aaa7f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

llvm/cmake/modules/TableGen.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ function(tablegen project ofn)
2121
message(FATAL_ERROR "${project}_TABLEGEN_EXE not set")
2222
endif()
2323

24-
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
24+
# Use depfile instead of globbing arbitrary *.td(s) for Ninja. We force
25+
# CMake versions older than v3.30 on Windows to use the fallback behavior
26+
# due to a depfile parsing bug on Windows paths in versions prior to 3.30.
27+
# https://gitlab.kitware.com/cmake/cmake/-/issues/25943
2528
cmake_policy(GET CMP0116 cmp0116_state)
26-
if(CMAKE_GENERATOR MATCHES "Ninja" AND cmp0116_state STREQUAL NEW)
29+
if(CMAKE_GENERATOR MATCHES "Ninja" AND cmp0116_state STREQUAL NEW
30+
AND NOT (CMAKE_HOST_WIN32 AND CMAKE_VERSION VERSION_LESS 3.30))
2731
# CMake emits build targets as relative paths but Ninja doesn't identify
2832
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
2933
# CMake handles this discrepancy for us, otherwise we use the fallback

mlir/cmake/modules/AddMLIR.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ function(_pdll_tablegen project ofn)
4242
message(FATAL_ERROR "${project}_TABLEGEN_EXE not set")
4343
endif()
4444

45-
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
45+
# Use depfile instead of globbing arbitrary *.td(s) for Ninja. We force
46+
# CMake versions older than v3.30 on Windows to use the fallback behavior
47+
# due to a depfile parsing bug on Windows paths in versions prior to 3.30.
48+
# https://gitlab.kitware.com/cmake/cmake/-/issues/25943
4649
cmake_policy(GET CMP0116 cmp0116_state)
47-
if(CMAKE_GENERATOR MATCHES "Ninja" AND cmp0116_state STREQUAL NEW)
50+
if(CMAKE_GENERATOR MATCHES "Ninja" AND cmp0116_state STREQUAL NEW
51+
AND NOT (CMAKE_HOST_WIN32 AND CMAKE_VERSION VERSION_LESS 3.30))
4852
# CMake emits build targets as relative paths but Ninja doesn't identify
4953
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
5054
# CMake handles this discrepancy for us. Otherwise, we use the fallback

0 commit comments

Comments
 (0)