diff --git a/CMakeLists.txt b/CMakeLists.txt index b19e422..6067303 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,6 +252,7 @@ set_target_properties(objc PROPERTIES LINK_FLAGS "${objc_LINK_FLAGS}" ) +set_property(TARGET PROPERTY NO_SONAME true) set(BUILD_STATIC_LIBOBJC false CACHE BOOL "Build the static version of libobjc") @@ -360,6 +361,7 @@ configure_file( add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + set(TESTS TRUE CACHE BOOL "Enable building the tests") diff --git a/arc.m b/arc.m index 86d0982..3a0b5c2 100644 --- a/arc.m +++ b/arc.m @@ -219,15 +219,18 @@ static inline void initAutorelease(void) } else { - [AutoreleasePool class]; - useARCAutoreleasePool = class_respondsToSelector(AutoreleasePool, - SELECTOR(_ARCCompatibleAutoreleasePool)); - NewAutoreleasePool = class_getMethodImplementation(object_getClass(AutoreleasePool), - SELECTOR(new)); - DeleteAutoreleasePool = class_getMethodImplementation(AutoreleasePool, - SELECTOR(release)); - AutoreleaseAdd = class_getMethodImplementation(object_getClass(AutoreleasePool), - SELECTOR(addObject:)); + useARCAutoreleasePool = (0 != class_getInstanceMethod(AutoreleasePool, + SELECTOR(_ARCCompatibleAutoreleasePool))); + if (!useARCAutoreleasePool) + { + [AutoreleasePool class]; + NewAutoreleasePool = class_getMethodImplementation(object_getClass(AutoreleasePool), + SELECTOR(new)); + DeleteAutoreleasePool = class_getMethodImplementation(AutoreleasePool, + SELECTOR(release)); + AutoreleaseAdd = class_getMethodImplementation(object_getClass(AutoreleasePool), + SELECTOR(addObject:)); + } } } }