From fefb333b01745b935571c0fa9d24ae4fc472bba1 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Mon, 25 Dec 2017 09:29:37 +0000 Subject: [PATCH] Remove the separate libobjcxx. If we don't find a separate dynamically linkable C++ runtime, then depend on the C++ standard library implementation. --- CMakeLists.txt | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa3e1dc..1a0e15c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ set(libobjc_HDRS objc/slot.h ) -set(libobjcxx_CXX_SRCS objcxx_eh.cc) +set(libobjc_CXX_SRCS objcxx_eh.cc) # For release builds, we disable spamming the terminal with warnings about # selector type mismatches @@ -187,31 +187,16 @@ if (ENABLE_OBJCXX) test_cxx_runtime CMAKE_FLAGS "-DCXX_RUNTIME=${CXX_RUNTIME}") message(STATUS "Is runtime useable? ${USERUNTIME}") - if (${FORCE_LIBOBJCXX} OR NOT ${USERUNTIME}) - message(STATUS "Forcing build of stand-alone libobjcxx") - add_library(objcxx SHARED ${libobjcxx_CXX_SRCS}) - set_target_properties(objcxx PROPERTIES - LINKER_LANGUAGE C - SOVERSION ${libobjc_VERSION} - ) - target_link_libraries(objcxx ${CXX_RUNTIME}) - set(CXX_RUNTIME "") - list(APPEND INSTALL_TARGETS objcxx) + if (NOT ${USERUNTIME}) + message(STATUS "libobjc will depend on C++ standard library") else () - set(libobjc_CXX_SRCS ${libobjcxx_CXX_SRCS}) # We don't want to link the STL implementation (e.g. libstdc++) if # we have a separate C++ runtime. set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") + target_link_libraries(objc ${CXX_RUNTIME}) endif () else () - message(STATUS "No C++ runtime library found") - add_library(objcxx SHARED ${libobjcxx_CXX_SRCS}) - set_target_properties(objcxx PROPERTIES - LINKER_LANGUAGE C - SOVERSION ${libobjc_VERSION} - ) - set(CXX_RUNTIME "") - list(APPEND INSTALL_TARGETS objcxx) + message(STATUS "libobjc will depend on C++ standard library") endif () endif (ENABLE_OBJCXX) @@ -248,8 +233,7 @@ endif () -# Explicitly link the C++ runtime and libgc if we are compiling with gc support. -target_link_libraries(objc ${CXX_RUNTIME}) +# Explicitly link libgc if we are compiling with gc support. if (LIBGC) target_link_libraries(objc ${LIBGC}) endif ()