This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Refactor and cleanup generating and installing symlinks to tools.
ClosedPublic

Authored by beanz on Sep 14 2015, 3:13 PM.

Details

Summary

This change generalizes symlink generation and makes symlinks to tools obey LLVM_TOOLCHAIN_TOOLS. It makes it so that if you exclude llvm-ar from LLVM_TOOLCHAIN_TOOLS you don't end up with broken symlinks to llvm-lib and llvm-ranlib in your install.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 34742.Sep 14 2015, 3:13 PM
beanz retitled this revision from to [CMake] Refactor and cleanup generating and installing symlinks to tools..
beanz updated this object.
beanz added reviewers: rafael, bogner, chapuni.
beanz added a subscriber: llvm-commits.
rafael accepted this revision.Sep 14 2015, 4:05 PM
rafael edited edge metadata.
This revision is now accepted and ready to land.Sep 14 2015, 4:05 PM
This revision was automatically updated to reflect the committed changes.
chapuni edited edge metadata.Sep 14 2015, 5:16 PM

Chris, do you think add_llvm_tool_symlink may be applicable just to llvm-ar?
I think also clang's cmakefiles may be cleaned up.

llvm/trunk/cmake/modules/AddLLVM.cmake
1026

I suggest we may reconsider the term "target" around here.
It handles both "the target of add_executable" and "the target of add_custom_target below". It may confuse us.

  • CMake uses "target" as each target command.
  • Userland command, like cp(1), ln(1) uses "target" as destination.

"dest" may be appropriate, IMO.

1038

I suggest lower indentation with two spaces, like;

add_custom_command(OUTPUT ${output_path}
  COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${target_binary}" "${output_path}"

Also emacs' cmake-mode suggests so.

1044

typo.

beanz added a subscriber: beanz.Sep 14 2015, 5:43 PM

I agree. I started looking at that this afternoon. I should have patches tomorrow.

-Chris

beanz added a comment.Sep 14 2015, 7:19 PM

Chapuni,

I've addressed all your feedback except the indentation in r247658. I'm not really sure we should be standardizing CMake formatting on the emacs plugin. I don't want to start a religious war, but I don't think we can assume emacs as a standard.

-Chris

I see. Just as your preference. :)

FYI, CMake distributes Auxiliary/cmake-mode.el

llvm/trunk/tools/llvm-ar/CMakeLists.txt