[libcxx] r291632 - [CMake][libcxx] Do not rely on the existence of c++abi or unwind targets

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 10 16:56:10 PST 2017


Author: phosek
Date: Tue Jan 10 18:56:10 2017
New Revision: 291632

URL: http://llvm.org/viewvc/llvm-project?rev=291632&view=rev
Log:
[CMake][libcxx] Do not rely on the existence of c++abi or unwind targets

There is no guaranteed order in which CMake files for individual
runtimes are invoked and therefore we cannot rely on existence of
targets defined in other runtimes. Use the new HAVE_<name> options
instead in those cases.

Differential Revision: https://reviews.llvm.org/D28391

Modified:
    libcxx/trunk/CMakeLists.txt
    libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=291632&r1=291631&r2=291632&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Tue Jan 10 18:56:10 2017
@@ -119,8 +119,7 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
           ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
     NO_DEFAULT_PATH
   )
-  if (NOT DEFINED LIBCXX_STANDALONE_BUILD AND
-      IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
+  if (IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
     set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
     set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
     set(LIBCXX_CXX_ABI_INTREE 1)

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=291632&r1=291631&r2=291632&view=diff
==============================================================================
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Tue Jan 10 18:56:10 2017
@@ -229,7 +229,8 @@ if (LIBCXX_ENABLE_STATIC)
     if (LIBCXX_CXX_ABI_LIBRARY_PATH)
       set(MERGE_ARCHIVES_SEARCH_PATHS "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
     endif()
-    if (TARGET ${LIBCXX_CXX_ABI_LIBRARY})
+    if ((TARGET ${LIBCXX_CXX_ABI_LIBRARY}) OR
+        (${LIBCXX_CXX_ABI_LIBRARY} STREQUAL "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI))
       set(MERGE_ARCHIVES_ABI_TARGET "$<TARGET_LINKER_FILE:${LIBCXX_CXX_ABI_LIBRARY}>")
     else()
       set(MERGE_ARCHIVES_ABI_TARGET
@@ -300,7 +301,9 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENAB
   set(LIBCXX_INTERFACE_LIBRARY_NAMES)
   foreach(lib ${LIBCXX_INTERFACE_LIBRARIES})
     # FIXME: Handle cxxabi_static and unwind_static.
-    if (TARGET ${lib})
+    if (TARGET ${lib} OR
+        (${lib} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI) OR
+        (${lib} MATCHES "unwind(_static|_shared)?" AND HAVE_LIBUNWIND))
       list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "$<TARGET_PROPERTY:${lib},OUTPUT_NAME>")
     else()
       list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "${lib}")




More information about the cfe-commits mailing list