[libcxx-commits] [PATCH] D60276: [libc++] Localize CMake code only related to the shared library

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 8 13:57:59 PDT 2019


mstorsjo added inline comments.


================
Comment at: lib/CMakeLists.txt:179
+    else()
+      target_link_libraries(cxx_shared PRIVATE "-Wl,--whole-archive,-Bstatic" "$<TARGET_LINKER_FILE:${LIBCXX_CXX_STATIC_ABI_LIBRARY}>" "-Wl,-Bdynamic,--no-whole-archive")
+    endif()
----------------
ldionne wrote:
> mstorsjo wrote:
> > This broke my compilation of libcxx for mingw (where I statically link in libc++abi into it), with the following error:
> > 
> > ```
> > CMake Error at lib/CMakeLists.txt:179 (target_link_libraries):
> >   Error evaluating generator expression:
> > 
> >     $<TARGET_LINKER_FILE:c++abi>
> > 
> >   No target "c++abi"
> > 
> > ```
> > 
> > I'm not really familiar enough with this aspect of CMake to know what is wrong here and what's expected. Prior to this patch, the corresponding code elsewhere in the same CMakeLists.txt did this:
> > 
> > ```
> >     add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic")
> >     add_library_flags("${LIBCXX_CXX_STATIC_ABI_LIBRARY}")
> >     add_library_flags("-Wl,-Bdynamic" "-Wl,--no-whole-archive")
> > ```
> > 
> How do you point the build to the static libc++abi? Is it not built in the tree?
No, it's not built in the same tree, I build libunwind/libcxxabi/libcxx standalone separately.

I configure cmake with
```
            -DLIBCXX_CXX_ABI=libcxxabi \
            -DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi/include \
            -DLIBCXX_CXX_ABI_LIBRARY_PATH=../../libcxxabi/build-$arch-$type/lib \
```
which up until now has worked fine for finding and using it.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D60276





More information about the libcxx-commits mailing list