There are a few goals here:
- Match what D132316 for LLVM_BINARY_DIR, for CMAKE_BINARY_DIR.
- Decrease the usages of LLVM_LIBDIR_SUFFIX, preparing us for D130586.
- Deduplicate code repeated across projects
Do this in this way:
- Shuffle around CMAKE_MODULE_PATH appending to allow include-ing our own modules earlier.
- Create new private/internal CMake modules and use them:
- LLVMGNUDirs
Like upstream CMake GNUInstallDirs, but sets variations of LLVMPROJ_BINARY_DIR. These are not CACHE PATHS because they are not intended to be user-modifyable.
LLVMPROJ_BINARY_LIBDIR is based on the base name of CMAKE_INSTALL_LIBDIR rather than LLVM_LIBDIR_SUFFIX. This cannot just end with "lib", because the "install" and "binary" base names need to line up for various relative paths to work. It doesn't just use LLVM_LIBDIR_SUFFIX because we are trying to phase that out.
Also has a compat shim that defaults CMAKE_INSTALL_LIBDIR based on LLVM_LIBDIR_SUFFIX. - LLVMSetIntDirs
Just here to deduplicate the defining of LLVM_LIBRARY_OUTPUT_INTDIR and friends between projects.
- LLVMGNUDirs
- Cleanup custom install path initialization code in the runtimes
Instead, I'd do this:
IMO that's easier on the eye.