Reland "[CMake] Do not set CMP0116 explicitly to old (#90385)"
This reverts commitfa65a228f4. This relands commitab405fb6e9. There was an issue where CMake versions <3.23.0 would not properly parse dep files, causing the build to file. This patch fixes that by just making CMake versions <3.23.0 use the fallback behavior.
This commit is contained in:
@@ -1,11 +1,5 @@
|
|||||||
# CMake policy settings shared between LLVM projects
|
# 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
|
# MSVC debug information format flags are selected via
|
||||||
# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of
|
# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of
|
||||||
# embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.
|
# embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.
|
||||||
|
|||||||
@@ -21,20 +21,26 @@ function(tablegen project ofn)
|
|||||||
message(FATAL_ERROR "${project}_TABLEGEN_EXE not set")
|
message(FATAL_ERROR "${project}_TABLEGEN_EXE not set")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
|
# Use depfile instead of globbing arbitrary *.td(s) for Ninja. We force
|
||||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
# CMake versions older than v3.30 on Windows to use the fallback behavior
|
||||||
# Make output path relative to build.ninja, assuming located on
|
# due to a depfile parsing bug on Windows paths in versions prior to 3.30.
|
||||||
# ${CMAKE_BINARY_DIR}.
|
# https://gitlab.kitware.com/cmake/cmake/-/issues/25943
|
||||||
|
# CMake versions older than v3.23 on other platforms use the fallback
|
||||||
|
# behavior as v3.22 and earlier fail to parse some depfiles that get
|
||||||
|
# generated, and this behavior was fixed in CMake commit
|
||||||
|
# e04a352cca523eba2ac0d60063a3799f5bb1c69e.
|
||||||
|
cmake_policy(GET CMP0116 cmp0116_state)
|
||||||
|
if(CMAKE_GENERATOR MATCHES "Ninja" AND cmp0116_state STREQUAL NEW
|
||||||
|
AND NOT (CMAKE_HOST_WIN32 AND CMAKE_VERSION VERSION_LESS 3.30)
|
||||||
|
AND NOT (CMAKE_VERSION VERSION_LESS 3.23))
|
||||||
# CMake emits build targets as relative paths but Ninja doesn't identify
|
# CMake emits build targets as relative paths but Ninja doesn't identify
|
||||||
# absolute path (in *.d) as relative path (in build.ninja)
|
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
|
||||||
# Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
|
# CMake handles this discrepancy for us, otherwise we use the fallback
|
||||||
file(RELATIVE_PATH ofn_rel
|
# logic.
|
||||||
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
|
|
||||||
set(additional_cmdline
|
set(additional_cmdline
|
||||||
-o ${ofn_rel}
|
-o ${ofn}
|
||||||
-d ${ofn_rel}.d
|
-d ${ofn}.d
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
DEPFILE ${ofn}.d
|
||||||
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
|
|
||||||
)
|
)
|
||||||
set(local_tds)
|
set(local_tds)
|
||||||
set(global_tds)
|
set(global_tds)
|
||||||
|
|||||||
@@ -42,20 +42,26 @@ function(_pdll_tablegen project ofn)
|
|||||||
message(FATAL_ERROR "${project}_TABLEGEN_EXE not set")
|
message(FATAL_ERROR "${project}_TABLEGEN_EXE not set")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use depfile instead of globbing arbitrary *.td(s) for Ninja.
|
# Use depfile instead of globbing arbitrary *.td(s) for Ninja. We force
|
||||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
# CMake versions older than v3.30 on Windows to use the fallback behavior
|
||||||
# Make output path relative to build.ninja, assuming located on
|
# due to a depfile parsing bug on Windows paths in versions prior to 3.30.
|
||||||
# ${CMAKE_BINARY_DIR}.
|
# https://gitlab.kitware.com/cmake/cmake/-/issues/25943
|
||||||
|
# CMake versions older than v3.23 on other platforms use the fallback
|
||||||
|
# behavior as v3.22 and earlier fail to parse some depfiles that get
|
||||||
|
# generated, and this behavior was fixed in CMake commit
|
||||||
|
# e04a352cca523eba2ac0d60063a3799f5bb1c69e.
|
||||||
|
cmake_policy(GET CMP0116 cmp0116_state)
|
||||||
|
if(CMAKE_GENERATOR MATCHES "Ninja" AND cmp0116_state STREQUAL NEW
|
||||||
|
AND NOT (CMAKE_HOST_WIN32 AND CMAKE_VERSION VERSION_LESS 3.30)
|
||||||
|
AND NOT (CMAKE_VERSION VERSION_LESS 3.23))
|
||||||
# CMake emits build targets as relative paths but Ninja doesn't identify
|
# CMake emits build targets as relative paths but Ninja doesn't identify
|
||||||
# absolute path (in *.d) as relative path (in build.ninja)
|
# absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
|
||||||
# Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
|
# CMake handles this discrepancy for us. Otherwise, we use the fallback
|
||||||
file(RELATIVE_PATH ofn_rel
|
# logic.
|
||||||
${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
|
|
||||||
set(additional_cmdline
|
set(additional_cmdline
|
||||||
-o ${ofn_rel}
|
-o ${ofn}
|
||||||
-d ${ofn_rel}.d
|
-d ${ofn}.d
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
DEPFILE ${ofn}.d
|
||||||
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
|
|
||||||
)
|
)
|
||||||
set(local_tds)
|
set(local_tds)
|
||||||
set(global_tds)
|
set(global_tds)
|
||||||
|
|||||||
Reference in New Issue
Block a user