diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-01-08 09:00:53 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-06-10 14:35:18 +0000 |
commit | d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229 (patch) | |
tree | 26ea96bfcdf9f425b45882b4945addac80aec0b1 /clang/cmake/modules | |
parent | fd3304ef8545081246f28cd37be98a05d6f24bdd (diff) | |
download | llvm-d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229.zip llvm-d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229.tar.gz llvm-d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229.tar.bz2 |
[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
Diffstat (limited to 'clang/cmake/modules')
-rw-r--r-- | clang/cmake/modules/AddClang.cmake | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake index 299f8ce..c58af0b 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake @@ -173,9 +173,9 @@ macro(add_clang_tool name) endmacro() macro(add_clang_symlink name dest) - add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE) + llvm_add_tool_symlink(CLANG ${name} ${dest} ALWAYS_GENERATE) # Always generate install targets - llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE) + llvm_install_symlink(CLANG name} ${dest} ALWAYS_GENERATE) endmacro() function(clang_target_link_libraries target type) |