Skip to content

Commit 38d2239

Browse files
Address feedback
1 parent c4d53f3 commit 38d2239

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

llvm/cmake/modules/TableGen.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ function(tablegen project ofn)
2222
endif()
2323

2424
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
25-
if(CMAKE_GENERATOR MATCHES "Ninja")
25+
cmake_policy(GET CMP0116 CMP0116_STATE)
26+
if(CMAKE_GENERATOR MATCHES "Ninja" AND CMP0116_STATE STREQUAL NEW)
2627
# CMake emits build targets as relative paths but Ninja doesn't identify
2728
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
28-
# CMake handles this discrepancy for us.
29+
# CMake handles this discrepancy for us, otherwise we use the fallback
30+
# logic.
2931
set(additional_cmdline
3032
-o ${ofn}
3133
-d ${ofn}.d

mlir/cmake/modules/AddMLIR.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ function(_pdll_tablegen project ofn)
4343
endif()
4444

4545
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
46-
if(CMAKE_GENERATOR MATCHES "Ninja")
47-
# Make output path relative to build.ninja, assuming located on
48-
# ${CMAKE_BINARY_DIR}.
46+
cmake_policy(GET CMP0116 CMP0116_STATE)
47+
if(CMAKE_GENERATOR MATCHES "Ninja" AND CMP0116_STATE STREQUAL NEW)
4948
# CMake emits build targets as relative paths but Ninja doesn't identify
5049
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
51-
# CMake handles this discrepancy for us.
50+
# CMake handles this discrepancy for us. Otherwise, we use the fallback
51+
# logic.
5252
set(additional_cmdline
5353
-o ${ofn}
5454
-d ${ofn}.d

0 commit comments

Comments
 (0)