A simple sed doing these substitutions:
- ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}\> -> ${LLVM_LIBRARY_DIR}
- ${LLVM_BINARY_DIR}/bin\> -> ${LLVM_TOOLS_BINARY_DIR}
where \> means "word boundary".
The only manual modifications were reverting changes in
- runtimes/CMakeLists.txt
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 some ${LLVM_BINARY_DIR}/lib without the ${LLVM_LIBDIR_SUFFIX}, but these refer to the lib subdirectory of the source (llvm/lib). That lib is automatically appended to make the local CMAKE_CURRENT_BINARY_DIR value by add_subdirectory; since the directory name in the source tree is fixed without any suffix, the corresponding CMAKE_CURRENT_BINARY_DIR will also be. We therefore do not replace it but leave it as-is.
This picks up where D133828 left off, getting the occurrences with*out* CMAKE_CFG_INTDIR. But this is difficult to do correctly and so not done in the (retroactively) previous diff.
This hopefully increases readability overall, and also decreases the usages of LLVM_LIBDIR_SUFFIX, preparing us for D130586.
The lib here is not used as a folder, so this should probably not be replaced?
It should probably include CMAKE_CFG_INTDIR though (i.e. ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports), to be consistent with other places, though this only affects the ninja multi-config build. I’m not sure if that works at all and it’s outside of the scope of this patch anyway.