[clang] d59730d - [CMake] Change GCC_INSTALL_PREFIX from warning to fatal error (#85891)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 20 22:45:41 PDT 2024
Author: Fangrui Song
Date: 2024-03-20T22:45:38-07:00
New Revision: d59730d7060f33dd1607be1fd7813be78759a953
URL: https://github.com/llvm/llvm-project/commit/d59730d7060f33dd1607be1fd7813be78759a953
DIFF: https://github.com/llvm/llvm-project/commit/d59730d7060f33dd1607be1fd7813be78759a953.diff
LOG: [CMake] Change GCC_INSTALL_PREFIX from warning to fatal error (#85891)
unless USE_DEPRECATED_GCC_INSTALL_PREFIX (temporary escape hatch) is
set. Setting GCC_INSTALL_PREFIX leads to a warning for Clang 18.1
(#77537) and will be completely removed for Clang 20.
Link:
discourse.llvm.org/t/add-gcc-install-dir-deprecate-gcc-toolchain-and-remove-gcc-install-prefix/65091
Link:
discourse.llvm.org/t/correct-cmake-parameters-for-building-clang-and-lld-for-riscv/72833
Added:
Modified:
clang/CMakeLists.txt
clang/docs/ReleaseNotes.rst
Removed:
################################################################################
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 47fc2e4886cfc2..761dab8c28c134 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -190,11 +190,12 @@ set(CLANG_RESOURCE_DIR "" CACHE STRING
set(C_INCLUDE_DIRS "" CACHE STRING
"Colon separated list of directories clang will search for headers.")
+set(USE_DEPRECATED_GCC_INSTALL_PREFIX OFF CACHE BOOL "Temporary workaround before GCC_INSTALL_PREFIX is completely removed")
set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." )
set(DEFAULT_SYSROOT "" CACHE STRING
"Default <path> to all compiler invocations for --sysroot=<path>." )
-if(GCC_INSTALL_PREFIX)
- message(WARNING "GCC_INSTALL_PREFIX is deprecated and will be removed. Use "
+if(GCC_INSTALL_PREFIX AND NOT USE_DEPRECATED_GCC_INSTALL_PREFIX)
+ message(FATAL_ERROR "GCC_INSTALL_PREFIX is deprecated and will be removed. Use "
"configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)"
"to specify the default --gcc-install-dir= or --gcc-triple=. --gcc-toolchain= is discouraged. "
"See https://github.com/llvm/llvm-project/pull/77537 for detail.")
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c0b0c8a8a3ea85..a9c55ef662a0b9 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -37,6 +37,9 @@ These changes are ones which we think may surprise users when upgrading to
Clang |release| because of the opportunity they pose for disruption to existing
code bases.
+- Setting the deprecated CMake variable ``GCC_INSTALL_PREFIX`` (which sets the
+ default ``--gcc-toolchain=``) now leads to a fatal error.
+
C/C++ Language Potentially Breaking Changes
-------------------------------------------
More information about the cfe-commits
mailing list