-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[CMake] Do not set CMP0116 explicitly to old #90385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Last I checked, setting this to new causes issues with cmake consuming TableGens dep files. I don't fully remember the sympton but I think it'd either claim that a TableGen command is always out of date or it would not capture all dependencies and therefore not rereun a TableGen command if an included file changed. There was a PR that would address this here #72333. Is this still needed/the case? |
Looks like it's still needed. I didn't realize this was an issue. Thanks for bringing this up! I'll make sure that gets fixed before we merge this/merge this as part of the fix. |
ef2ba58
to
82e7883
Compare
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 llvm#83727.
82e7883
to
c4d53f3
Compare
Updated to fix the issues based on the patch in #72333. |
@llvm/pr-subscribers-mlir Author: Aiden Grossman (boomanaiden154) ChangesCMP0116 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. Partially fixes #83727. Full diff: https://github.com/llvm/llvm-project/pull/90385.diff 3 Files Affected:
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index f19dfd71657171..f6ecc40d8f1279 100644
--- a/cmake/Modules/CMakePolicy.cmake
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -1,11 +1,5 @@
# CMake policy settings shared between LLVM projects
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
- cmake_policy(SET CMP0116 OLD)
-endif()
-
# MSVC debug information format flags are selected via
# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of
# embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.
diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index ffcc718b47775f..d2ff1cfa553b39 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -23,18 +23,13 @@ function(tablegen project ofn)
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
if(CMAKE_GENERATOR MATCHES "Ninja")
- # Make output path relative to build.ninja, assuming located on
- # ${CMAKE_BINARY_DIR}.
# CMake emits build targets as relative paths but Ninja doesn't identify
- # absolute path (in *.d) as relative path (in build.ninja)
- # Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
- file(RELATIVE_PATH ofn_rel
- ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
+ # absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
+ # CMake handles this discrepancy for us.
set(additional_cmdline
- -o ${ofn_rel}
- -d ${ofn_rel}.d
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
+ -o ${ofn}
+ -d ${ofn}.d
+ DEPFILE ${ofn}.d
)
set(local_tds)
set(global_tds)
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index a3324705c525ce..bbe5976d7a3e76 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -47,15 +47,12 @@ function(_pdll_tablegen project ofn)
# Make output path relative to build.ninja, assuming located on
# ${CMAKE_BINARY_DIR}.
# CMake emits build targets as relative paths but Ninja doesn't identify
- # absolute path (in *.d) as relative path (in build.ninja)
- # Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
- file(RELATIVE_PATH ofn_rel
- ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
+ # absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
+ # CMake handles this discrepancy for us.
set(additional_cmdline
- -o ${ofn_rel}
- -d ${ofn_rel}.d
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
+ -o ${ofn}
+ -d ${ofn}.d
+ DEPFILE ${ofn}.d
)
set(local_tds)
set(global_tds)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me reconfirm later. apparently looks good.
Note, when I introduced it, CMake didn't have CMP0116 NEW
behavior.
@chapuni Are you able to take another look at this when you get a chance? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boomanaiden154 Sorry for delay. I was busy the last week.
I just wanted to reconfirm in my local tree, but it'd be fine now!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/97/builds/6310 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/4193 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/10933 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/8765 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/99/builds/6185 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/117/builds/9091 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/22004 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/75/builds/6450 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/118/builds/6008 Here is the relevant piece of the build log for the reference
|
This reverts commit ab405fb. This caused quite a few buildbot failures that need further investigation.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/15496 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/7/builds/13956 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/152/builds/2361 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/16934 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/16923 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/119/builds/5370 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/113/builds/6961 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/92/builds/17791 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/151/builds/5530 Here is the relevant piece of the build log for the reference
|
FYI, this works fine in my side. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/105/builds/8734 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/28/builds/8742 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/158/builds/8207 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/127/builds/3122 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/4304 Here is the relevant piece of the build log for the reference
|
It's definitely broken in some cases. I've been able to reproduce the failure on Ubuntu 22.04 with CMake 3.22.1. The issue seems to be around Running the |
It looks like the issue was present all the way through v3.22 (including v3.22.6) and is gone by the time v3.23.0 lands. I'm going to bisect. |
It ended up bisecting down to e04a352cca523eba2ac0d60063a3799f5bb1c69e in CMake, which about makes sense given the commit description:
I think we might just need to use fall back behavior for CMake <3.23.0. I'll push the patch for that and see how it goes. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2791 Here is the relevant piece of the build log for the reference
|
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.
Partially fixes #83727.