From a575db73926a134a24f5744f5dadf23940c4f096 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Sat, 22 Aug 2020 17:34:43 +0100 Subject: [PATCH] Fix C++ runtime detection. - Don't try to detect libc++abi. It doesn't actually work, so don't try it. - Correctly try to link the standard library. This should fix the build on GNU/Linux systems with libc++abi.so installed (including our Ubuntu CI!). --- CMake/CMakeLists.txt | 2 +- CMakeLists.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt index 0f1553f..0bfd1bd 100644 --- a/CMake/CMakeLists.txt +++ b/CMake/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(test_cxx_runtime) add_executable(test_cxx_runtime typeinfo_test.cc) -set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") +add_executable(test_cxx_stdlib typeinfo_test.cc) if (CXX_RUNTIME) target_link_libraries(test_cxx_runtime ${CXX_RUNTIME}) set_target_properties(test_cxx_runtime PROPERTIES diff --git a/CMakeLists.txt b/CMakeLists.txt index d4cbfbd..8de45da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,8 +284,9 @@ if (ENABLE_OBJCXX) if (NOT CXX_RUNTIME) test_cxx(supc++ false) endif (NOT CXX_RUNTIME) + # libc++abi does not currently work, don't try it. if (NOT CXX_RUNTIME) - test_cxx(c++abi false) + # test_cxx(c++abi false) endif (NOT CXX_RUNTIME) # If we have a C++ ABI library, then we can produce a single libobjc that @@ -295,10 +296,11 @@ if (ENABLE_OBJCXX) message(STATUS "Using ${CXX_RUNTIME} as the C++ runtime library") else() message(STATUS "Testing C++ standard library") + message(STATUS "Using ${CMAKE_C_COMPILER}") try_compile(USERUNTIME "${CMAKE_BINARY_DIR}/CMake" "${CMAKE_CURRENT_LIST_DIR}/CMake" - test_cxx_runtime) + test_cxx_stdlib) if (${USERUNTIME}) message(STATUS "libobjc will depend on C++ standard library") set(CXXRT_IS_STDLIB true)