[all-commits] [llvm/llvm-project] d5daa5: [cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore

John Ericson via All-commits all-commits at lists.llvm.org
Fri Jun 10 07:35:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229
      https://github.com/llvm/llvm-project/commit/d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229
  Author: John Ericson <John.Ericson at Obsidian.Systems>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M bolt/tools/CMakeLists.txt
    M bolt/tools/driver/CMakeLists.txt
    M bolt/tools/heatmap/CMakeLists.txt
    M bolt/tools/merge-fdata/CMakeLists.txt
    M clang/CMakeLists.txt
    M clang/cmake/modules/AddClang.cmake
    M flang/CMakeLists.txt
    M flang/cmake/modules/AddFlang.cmake
    M lld/CMakeLists.txt
    M lld/cmake/modules/AddLLD.cmake
    M llvm/cmake/modules/AddLLVM.cmake
    M llvm/cmake/modules/CMakeLists.txt
    M llvm/cmake/modules/LLVMConfig.cmake.in
    M llvm/cmake/modules/TableGen.cmake
    M mlir/CMakeLists.txt
    M mlir/cmake/modules/AddMLIR.cmake
    M mlir/tools/mlir-cpu-runner/CMakeLists.txt
    M mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
    M mlir/tools/mlir-lsp-server/CMakeLists.txt
    M mlir/tools/mlir-opt/CMakeLists.txt
    M mlir/tools/mlir-pdll-lsp-server/CMakeLists.txt
    M mlir/tools/mlir-reduce/CMakeLists.txt
    M mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
    M mlir/tools/mlir-translate/CMakeLists.txt
    M mlir/tools/mlir-vulkan-runner/CMakeLists.txt
    M mlir/tools/tblgen-lsp-server/CMakeLists.txt
    M openmp/libomptarget/tools/CMakeLists.txt
    M openmp/libomptarget/tools/deviceinfo/CMakeLists.txt

  Log Message:
  -----------
  [cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore

First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS
builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as
`CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when
downstream projects try to install there too this breaks because our
builds always install to fresh directories for isolation's sake.

Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the
other specially crafted `LLVM_CONFIG_*` variables substituted in
`llvm/cmake/modules/LLVMConfig.cmake.in`.

@beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a
dangling reference in `AddLLVM`, but I am suspicious of how this
variable doesn't follow the pattern.

Those other ones are carefully made to be build-time vs install-time
variables depending on which `LLVMConfig.cmake` is being generated, are
carefully made relative as appropriate, etc. etc. For my NixOS use-case
they are also fine because they are never used as downstream install
variables, only for reading not writing.

To avoid the problems I face, and restore symmetry, I deleted the
exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s.
`AddLLVM` now instead expects each project to define its own, and they
do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports
`LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in
the usual way, matching the other remaining exported variables.

For the `AddLLVM` changes, I tried to copy the existing pattern of
internal vs non-internal or for LLVM vs for downstream function/macro
names, but it would good to confirm I did that correctly.

Reviewed By: nikic

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




More information about the All-commits mailing list