Skip to content

Commit d59730d

Browse files
authored
[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
1 parent 26c290b commit d59730d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

clang/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,12 @@ set(CLANG_RESOURCE_DIR "" CACHE STRING
190190
set(C_INCLUDE_DIRS "" CACHE STRING
191191
"Colon separated list of directories clang will search for headers.")
192192

193+
set(USE_DEPRECATED_GCC_INSTALL_PREFIX OFF CACHE BOOL "Temporary workaround before GCC_INSTALL_PREFIX is completely removed")
193194
set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." )
194195
set(DEFAULT_SYSROOT "" CACHE STRING
195196
"Default <path> to all compiler invocations for --sysroot=<path>." )
196-
if(GCC_INSTALL_PREFIX)
197-
message(WARNING "GCC_INSTALL_PREFIX is deprecated and will be removed. Use "
197+
if(GCC_INSTALL_PREFIX AND NOT USE_DEPRECATED_GCC_INSTALL_PREFIX)
198+
message(FATAL_ERROR "GCC_INSTALL_PREFIX is deprecated and will be removed. Use "
198199
"configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)"
199200
"to specify the default --gcc-install-dir= or --gcc-triple=. --gcc-toolchain= is discouraged. "
200201
"See https://github.com/llvm/llvm-project/pull/77537 for detail.")

clang/docs/ReleaseNotes.rst

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ These changes are ones which we think may surprise users when upgrading to
3737
Clang |release| because of the opportunity they pose for disruption to existing
3838
code bases.
3939

40+
- Setting the deprecated CMake variable ``GCC_INSTALL_PREFIX`` (which sets the
41+
default ``--gcc-toolchain=``) now leads to a fatal error.
42+
4043
C/C++ Language Potentially Breaking Changes
4144
-------------------------------------------
4245

0 commit comments

Comments
 (0)