[libcxx-commits] [PATCH] D84426: [runtimes] Build static libraries in try_compile

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 5 11:53:35 PDT 2021


phosek added a comment.

In D84426#2178955 <https://reviews.llvm.org/D84426#2178955>, @compnerd wrote:

> For many tests, it makes sense to just do the static library test - that is if they are limited to something that is compile time only.  For link time tests, this doesn't work (e.g. testing if `librt` is needed).  Perhaps we should make this conditional on `NOT BUILD_SHARED_LIBS`?  This would be the default behaviour with LLVM, but still would let you opt out were you to build a shared library.

FYI I've been looking into this recently and the direction I'm thinking about is providing custom functions for checking flags, for example `runtime_check_c_compiler_flag`, `runtime_check_cxx_compiler_flag` and `runtime_check_linker_compiler_flag`, where only the first two would set `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY` but the last one would need a different solution like using `-nostarfiles -nodefaultlibs` together with a custom source file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84426



More information about the libcxx-commits mailing list