[libcxx-commits] [PATCH] D120719: [runtimes] Always configure libc++abi before libc++

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 14 13:30:08 PDT 2022


ldionne added a comment.

In D120719#3376333 <https://reviews.llvm.org/D120719#3376333>, @phosek wrote:

> @ldionne this is what I had in mind:
>
>   cmake_minimum_required(VERSION 3.13.4)
>   project(Test C)
>   
>   add_library(A STATIC a.c)
>   
>   add_library(C SHARED c.c)
>   target_link_libraries(C PRIVATE "$<GENEX_EVAL:$<TARGET_LINKER_FILE:B>>")
>   
>   add_library(B IMPORTED STATIC)
>   set_target_properties(B PROPERTIES IMPORTED_LOCATION "$<TARGET_LINKER_FILE:A>")
>
> It seems to be working as expected in this minimal example.

This is really clever, but the problem is that when you do `target_link_libraries(C PRIVATE "$<GENEX_EVAL:$<TARGET_LINKER_FILE:B>>")`, you lose the property of linking against the `B` target itself -- you're only linking against a specific `.dylib` or `.a` file, but you don't get all the target-level stuff like transitive `target_compile_definitions`, `target_include_directories` and so on, right? So for example, below `C` won't get the includes added by `B`:

  cmake_minimum_required(VERSION 3.13.4)
  project(Test C)
  
  add_library(A STATIC a.c)
  
  add_library(C SHARED c.c)
  target_link_libraries(C PRIVATE "$<GENEX_EVAL:$<TARGET_LINKER_FILE:B>>") # This doesn't get `-I some/path/include`
  
  add_library(B IMPORTED STATIC)
  target_include_directories(B INTERFACE "some/path/include")
  set_target_properties(B PROPERTIES IMPORTED_LOCATION "$<TARGET_LINKER_FILE:A>")


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120719



More information about the libcxx-commits mailing list