Skip to content

Commit c4d53f3

Browse files
[CMake] Do not set CMP0116 explicitly to old
CMP0116 was originally set to old to get rid of warnings. However, this behavior is now set to new by default with the minimum CMake version that LLVM requires so does not produce any warnings, and setting it explicitly to old does produce a warning in newer CMake versions. Due to these reasons, remove this check for now. Splitting off from removing the CMP0114 check just in case something breaks. This also removes two instances of a workaround related to the old behavior of CMP0116. Partially fixes #83727.
1 parent cf4442e commit c4d53f3

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

cmake/Modules/CMakePolicy.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# CMake policy settings shared between LLVM projects
22

3-
# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
4-
# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
5-
if(POLICY CMP0116)
6-
cmake_policy(SET CMP0116 OLD)
7-
endif()
8-
93
# MSVC debug information format flags are selected via
104
# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of
115
# embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.

llvm/cmake/modules/TableGen.cmake

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@ function(tablegen project ofn)
2323

2424
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
2525
if(CMAKE_GENERATOR MATCHES "Ninja")
26-
# Make output path relative to build.ninja, assuming located on
27-
# ${CMAKE_BINARY_DIR}.
2826
# CMake emits build targets as relative paths but Ninja doesn't identify
29-
# absolute path (in *.d) as relative path (in build.ninja)
30-
# Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
31-
file(RELATIVE_PATH ofn_rel
32-
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
27+
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
28+
# CMake handles this discrepancy for us.
3329
set(additional_cmdline
34-
-o ${ofn_rel}
35-
-d ${ofn_rel}.d
36-
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
37-
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
30+
-o ${ofn}
31+
-d ${ofn}.d
32+
DEPFILE ${ofn}.d
3833
)
3934
set(local_tds)
4035
set(global_tds)

mlir/cmake/modules/AddMLIR.cmake

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,12 @@ function(_pdll_tablegen project ofn)
4747
# Make output path relative to build.ninja, assuming located on
4848
# ${CMAKE_BINARY_DIR}.
4949
# CMake emits build targets as relative paths but Ninja doesn't identify
50-
# absolute path (in *.d) as relative path (in build.ninja)
51-
# Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
52-
file(RELATIVE_PATH ofn_rel
53-
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
50+
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
51+
# CMake handles this discrepancy for us.
5452
set(additional_cmdline
55-
-o ${ofn_rel}
56-
-d ${ofn_rel}.d
57-
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
58-
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
53+
-o ${ofn}
54+
-d ${ofn}.d
55+
DEPFILE ${ofn}.d
5956
)
6057
set(local_tds)
6158
set(global_tds)

0 commit comments

Comments
 (0)