<div dir="ltr">Hi Petr,<div><br></div><div>This is breaking static builds of the libraries, cmake complaints with:</div><div><br></div><div>"CMake Error at projects/libcxxabi/src/CMakeLists.txt:134 (target_link_libraries):</div><div>  Target "unwind" of type UTILITY may not be linked into another target.  One</div><div>  may link only to STATIC or SHARED libraries, or to executables with the</div><div>  ENABLE_EXPORTS property set."</div><div><br></div><div>Our build config is:</div><div><br></div><div> -DLLVM_ENABLE_ASSERTIONS=ON -DLIBCXX_ENABLE_ASSERTIONS=ON -DLIBCXXABI_USE_LLVM_UNWINDER=ON  -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXXABI_ENABLE_SHARED=OFF -DLIBUNWIND_ENABLE_SHARED=OFF<br></div><div><br></div><div>/ Asiri</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 9, 2017 at 2:19 AM, Petr Hosek via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: phosek<br>
Date: Wed Feb  8 20:19:43 2017<br>
New Revision: 294553<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=294553&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=294553&view=rev</a><br>
Log:<br>
[libcxx][CMake] Support in-tree libunwind when building as part of runtimes<br>
<br>
When building as part of runtimes, there is no predefined order in<br>
which the runtimes are loaded, so the targets from other projects<br>
might not be available. We need to rely on HAVE_<name> variables<br>
instead in that case.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D29575" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29575</a><br>
<br>
Modified:<br>
    libcxx/trunk/CMakeLists.txt<br>
    libcxx/trunk/lib/CMakeLists.<wbr>txt<br>
<br>
Modified: libcxx/trunk/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=294553&r1=294552&r2=294553&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/<wbr>CMakeLists.txt?rev=294553&r1=<wbr>294552&r2=294553&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/CMakeLists.txt (original)<br>
+++ libcxx/trunk/CMakeLists.txt Wed Feb  8 20:19:43 2017<br>
@@ -158,6 +158,7 @@ option(LIBCXX_ENABLE_ABI_<wbr>LINKER_SCRIPT<br>
 # Build libc++abi with libunwind. We need this option to determine whether to<br>
 # link with libunwind or libgcc_s while running the test cases.<br>
 option(LIBCXXABI_USE_LLVM_<wbr>UNWINDER "Build and use the LLVM unwinder." OFF)<br>
+option(LIBCXXABI_ENABLE_<wbr>STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)<br>
<br>
 # Target options ------------------------------<wbr>------------------------------<wbr>--<br>
 option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})<br>
<br>
Modified: libcxx/trunk/lib/CMakeLists.<wbr>txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=294553&r1=294552&r2=294553&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/lib/<wbr>CMakeLists.txt?rev=294553&r1=<wbr>294552&r2=294553&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/lib/CMakeLists.<wbr>txt (original)<br>
+++ libcxx/trunk/lib/CMakeLists.<wbr>txt Wed Feb  8 20:19:43 2017<br>
@@ -89,9 +89,9 @@ add_library_flags_if(LIBCXX_<wbr>HAVE_CXX_ATO<br>
<br>
 # Add the unwinder library.<br>
 if (LIBCXXABI_USE_LLVM_UNWINDER)<br>
-  if (TARGET unwind_shared)<br>
+  if (NOT LIBCXXABI_ENABLE_STATIC_<wbr>UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))<br>
     add_interface_library(unwind_<wbr>shared)<br>
-  elseif (TARGET unwind_static)<br>
+  elseif (LIBCXXABI_ENABLE_STATIC_<wbr>UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))<br>
     add_interface_library(unwind_<wbr>static)<br>
   else()<br>
     add_interface_library(unwind)<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>