summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2017-01-11 00:56:10 +0000
committerPetr Hosek <phosek@chromium.org>2017-01-11 00:56:10 +0000
commit94fc5a96f58071703d81d14690094dcd266a5e17 (patch)
tree6463f4a221a8d7be06958b4290bdf589090d0862
parent39441fe9f00a58ffc2fdff92a4b0e8a280a5f444 (diff)
downloadlibcxx-94fc5a96f58071703d81d14690094dcd266a5e17.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291632 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt3
-rw-r--r--lib/CMakeLists.txt7
2 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae0cf7e4b..fb7b9457f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index cc3ed16b9..39adc594e 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -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_ENABLE_ABI_LINKER_SCRIPT)
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}")