[llvm] 71a2a62 - [CMake] Pass symlink dependency to add_llvm_install_targets explicitly
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 14:51:40 PST 2020
Author: Petr Hosek
Date: 2020-01-06T14:51:32-08:00
New Revision: 71a2a62163cfafbc31cd827106506c73ff49e8b5
URL: https://github.com/llvm/llvm-project/commit/71a2a62163cfafbc31cd827106506c73ff49e8b5
DIFF: https://github.com/llvm/llvm-project/commit/71a2a62163cfafbc31cd827106506c73ff49e8b5.diff
LOG: [CMake] Pass symlink dependency to add_llvm_install_targets explicitly
The install-${name}-stripped targets don't strip when ${name} is being
symlinked, e.g. llvm-ar or llvm-objcopy. The problem is that
llvm_install_symlink passes install-${dest} as a dependency of
install-${name}, e.g. install-llvm-ar becomes a dependency of both
install-llvm-ranlib and install-llvm-ranlib-stripped. What this means is
that when installing a distribution that contains both llvm-ar and
llvm-ranlib is that first the stripped version of llvm-ar is installed
(by the install-llvm-ar-stripped target) and then it's overwritten by an
unstripped version of llvm-ar bnecause install-llvm-ranlib-stripped has
install-llvm-ranlib as a dependency as mentioned earlier. To avoid this
issue, rather than passing the install-${dest} as dependency, we
introduce a new argument to add_llvm_install_targets for symlink target
which expands it into an appropriate dependency, i.e. install-${dest}
for install-${name} target and install-${dest}-stripped for
install-${name}-stripped.
Differential Revision: https://reviews.llvm.org/D71951
Added:
Modified:
llvm/cmake/modules/AddLLVM.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index fad825fb7ca9..c1bbae788781 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -642,7 +642,7 @@ function(llvm_add_library name)
endfunction()
function(add_llvm_install_targets target)
- cmake_parse_arguments(ARG "" "COMPONENT;PREFIX" "DEPENDS" ${ARGN})
+ cmake_parse_arguments(ARG "" "COMPONENT;PREFIX;SYMLINK" "DEPENDS" ${ARGN})
if(ARG_COMPONENT)
set(component_option -DCMAKE_INSTALL_COMPONENT="${ARG_COMPONENT}")
endif()
@@ -679,6 +679,11 @@ function(add_llvm_install_targets target)
add_dependencies(${target} ${target_dependencies})
add_dependencies(${target}-stripped ${target_dependencies})
endif()
+
+ if(ARG_SYMLINK)
+ add_dependencies(${target} install-${ARG_SYMLINK})
+ add_dependencies(${target}-stripped install-${ARG_SYMLINK}-stripped)
+ endif()
endfunction()
function(add_llvm_component_library name)
@@ -1627,8 +1632,9 @@ function(llvm_install_library_symlink name dest type)
if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
add_llvm_install_targets(install-${name}
- DEPENDS ${name} ${dest} install-${dest}
- COMPONENT ${name})
+ DEPENDS ${name} ${dest}
+ COMPONENT ${name}
+ SYMLINK ${dest})
endif()
endfunction()
@@ -1660,8 +1666,9 @@ function(llvm_install_symlink name dest)
if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
add_llvm_install_targets(install-${name}
- DEPENDS ${name} ${dest} install-${dest}
- COMPONENT ${name})
+ DEPENDS ${name} ${dest}
+ COMPONENT ${name}
+ SYMLINK ${dest})
endif()
endfunction()
More information about the llvm-commits
mailing list