[all-commits] [llvm/llvm-project] 4169b5: [runtimes] [CMake] Fix checks for -Werror when bui...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Thu May 12 14:30:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4169b5251f58cc0eb2ac6c3b4b9990a51728aac6
      https://github.com/llvm/llvm-project/commit/4169b5251f58cc0eb2ac6c3b4b9990a51728aac6
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-05-13 (Fri, 13 May 2022)

  Changed paths:
    M runtimes/CMakeLists.txt

  Log Message:
  -----------
  [runtimes] [CMake] Fix checks for -Werror when building with incomplete toolchains

When we add `--unwindlib=none` during the CMake configure phase (to
make CMake linking tests succeed before the unwind library has been
built for the first time - when bootstrapping a cross toolchain from
scratch), we add it to `CMAKE_REQUIRED_FLAGS` to make later CMake tests
pass.

When the option is added to `CMAKE_REQUIRED_FLAGS`, it gets added to
both compilation and linking commands. When --unwindlib=none is added
to the compilation command, it causes warnings (about being unused
during compilation, as it only affects linking).

When all CMake test compilations produce warnings, later CMake tests
for `-Werror` fail.

Add `--{start,end}-no-unused-arguments` around `--unwindlib=none`, if
supported, to avoid unnecessary warnings due to this option.

If the CMake requirement is bumped to 3.14, we could use
`CMAKE_REQUIRED_LINK_OPTIONS` instead, removing the need for the
`--{start,end}-no-unused-arguments` options. (However, do note that
`CMAKE_REQUIRED_LINK_OPTIONS` is problematic in combination with
`CMAKE_TRY_COMPILE_TARGET_TYPE` set to `STATIC_LIBRARY`; see
https://gitlab.kitware.com/cmake/cmake/-/issues/23454.)

Differential Revision: https://reviews.llvm.org/D124377




More information about the All-commits mailing list