[libc++abi] Fix bug which cased the static libunwind to always be chosen
authorEric Fiselier <eric@efcs.ca>
Sun, 9 Oct 2016 20:44:48 +0000 (20:44 +0000)
committerEric Fiselier <eric@efcs.ca>
Sun, 9 Oct 2016 20:44:48 +0000 (20:44 +0000)
llvm-svn: 283699

libcxxabi/src/CMakeLists.txt

index 7cbfdf5..2e08aa3 100644 (file)
@@ -54,14 +54,14 @@ if (LIBCXXABI_ENABLE_THREADS)
 endif()
 
 append_if(libraries LIBCXXABI_HAS_C_LIB c)
-
 if (LIBCXXABI_USE_LLVM_UNWINDER)
-  if (NOT LIBCXXABI_STANDALONE_BUILD)
-    if (LIBUNWIND_ENABLE_SHARED)
-      list(APPEND libraries unwind_shared)
-    else()
-      list(APPEND libraries unwind_static)
-    endif()
+  # Prefer using the in-tree version of libunwind, either shared or static. If
+  # none are found fall back to using -lunwind.
+  # FIXME: Is it correct to prefer the static version of libunwind?
+  if (TARGET unwind_shared)
+    list(APPEND libraries unwind_shared)
+  elseif(TARGET unwind_static)
+    list(APPEND libraries unwind_static)
   else()
     list(APPEND libraries unwind)
   endif()