[PATCH] D151013: [CMake] Add option to link LLVM/subproject executables

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 23:56:54 PDT 2023


phosek added a comment.

In D151013#4378129 <https://reviews.llvm.org/D151013#4378129>, @aidengrossman wrote:

> I used `llvm_check_linker_flags` here to test if the library can be linked against. Using `find_library` seems like it would be best practice, but as far as my experimentation goes, the default search paths that `find_library` goes through doesn't include the `<compiler binary dir>../lib/<target triple>` directory that stores runtime build artifacts for multi-stage builds. I'm very open to changing that element if there's a better option.

We usually use `check_library_exists` for these types of checks, see https://cmake.org/cmake/help/latest/module/CheckLibraryExists.html. The name of the variable should be `HAVE_LLVM_LIBC` for consistency with the rest of LLVM.



================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:1304
+
+set(LLVM_ENABLE_LLVM_LIBC OFF CACHE BOOL "Set to on to link all LLVM executables against LLVM libc, assuming it is accessible by the host compiler")
+
----------------
Can you make it an `option` akin to `LLVM_ENABLE_LIBCXX` and also move this to `llvm/CMakeLists.txt`? See https://github.com/llvm/llvm-project/blob/e9ddb584e80194ab9f54e873aa733ae97da3bb95/llvm/CMakeLists.txt#L560 for reference.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151013/new/

https://reviews.llvm.org/D151013



More information about the llvm-commits mailing list