[clang] [CMake] Deprecate GCC_INSTALL_PREFIX (PR #77537)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 14:53:35 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Fangrui Song (MaskRay)

<details>
<summary>Changes</summary>

Part of https://reviews.llvm.org/D158218

GCC_INSTALL_PREFIX is a rarely-used legacy option inherited from
pre-CMake build system and has configuration file replacement nowadays.
Many `clang/test/Driver` tests specify `--gcc-toolchain=` or
`--gcc-toolchain=""` to prevent failures when `GCC_INSTALL_PREFIX` is
specified: some contributors add them to fix tests and some just do
cargo culting. This is not healthy for contributors adding cross
compilation support for this rarely used option.

`DEFAULT_SYSROOT` should in spirit be deprecated as well, but a relative
path doesn't have good replacement, so don't deprecate it for now.

Link: https://discourse.llvm.org/t/add-gcc-install-dir-deprecate-gcc-toolchain-and-remove-gcc-install-prefix/65091
Link: https://discourse.llvm.org/t/correct-cmake-parameters-for-building-clang-and-lld-for-riscv/72833


---
Full diff: https://github.com/llvm/llvm-project/pull/77537.diff


1 Files Affected:

- (modified) clang/CMakeLists.txt (+6) 


``````````diff
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 9f814478c45503..7076907da2528a 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -193,6 +193,12 @@ set(C_INCLUDE_DIRS "" CACHE STRING
 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 "
+    "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. "
+    "The option is often unneeded or better replaced with --gcc-install-dir=/--gcc-triple.")
+endif()
 
 set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/77537


More information about the cfe-commits mailing list