This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are better-suited, part 1
ClosedPublic

Authored by Ericson2314 on Sep 13 2022, 8:39 PM.

Details

Summary

A simple sed doing these substitutions:

  • ${LLVM_BINARY_DIR}/\$\{CMAKE_CFG_INTDIR}/lib(${LLVM_LIBDIR_SUFFIX})?\> -> ${LLVM_LIBRARY_DIR}
  • ${LLVM_BINARY_DIR}/\$\{CMAKE_CFG_INTDIR}/bin\> -> ${LLVM_TOOLS_BINARY_DIR}

where \> means "word boundary".

The only manual modifications were reverting changes in

  • compiler-rt/cmake/Modules/CompilerRTUtils.cmake

because these were "entry points" where we wanted to tread carefully not not introduce a "loop" which would end with an undefined variable being expanded to nothing.

There are many more occurrences without CMAKE_CFG_INTDIR, but those are left for D132316 as they have proved somewhat tricky to fix.

This hopefully increases readability overall, and also decreases the usages of LLVM_LIBDIR_SUFFIX, preparing us for D130586.

Diff Detail

Event Timeline

Ericson2314 created this revision.Sep 13 2022, 8:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2022, 8:39 PM
Herald added a subscriber: mgorny. · View Herald Transcript
Ericson2314 requested review of this revision.Sep 13 2022, 8:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 13 2022, 8:39 PM
Ericson2314 edited the summary of this revision. (Show Details)Sep 13 2022, 8:40 PM
sebastian-ne accepted this revision.Sep 14 2022, 1:53 AM
This revision is now accepted and ready to land.Sep 14 2022, 1:53 AM