https://github.com/apple/swift-corelibs-libdispatch/pull/534 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bae74e..0877f56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,6 +190,8 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Android) find_package(LibRT) endif() +find_package(BlocksRuntime QUIET) + check_function_exists(_pthread_workqueue_init HAVE__PTHREAD_WORKQUEUE_INIT) check_function_exists(getprogname HAVE_GETPROGNAME) check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 570c919..6d45899 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,4 @@ - -if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) +if(NOT BlocksRuntime_FOUND) add_subdirectory(BlocksRuntime) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0176a06..523ae06 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -78,9 +78,6 @@ function(add_unit_test name) # to reduce probability of test failures due to machine load. target_compile_options(${name} PRIVATE -DLENIENT_DEADLINES=1) endif() - target_include_directories(${name} - SYSTEM BEFORE PRIVATE - "${BlocksRuntime_INCLUDE_DIR}") if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC") target_compile_options(${name} PRIVATE -Xclang -fblocks) target_compile_options(${name} PRIVATE /W3 -Wno-deprecated-declarations)