From f49931127fe7673931c6550194c593923b2fbfd7 Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Sun, 24 Nov 2019 08:24:56 +0100 Subject: [PATCH 1/2] build: search for system-supplied libBlocksRuntime This allows the user to provide a version of libBlocksRuntime on systems other than Darwin. --- CMakeLists.txt | 2 ++ cmake/modules/FindBlocksRuntime.cmake | 2 ++ src/CMakeLists.txt | 3 +-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75c419c13..458c1cd95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,8 @@ endif() find_package(LibRT) +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/cmake/modules/FindBlocksRuntime.cmake b/cmake/modules/FindBlocksRuntime.cmake index 111a5d634..eb3f539e9 100644 --- a/cmake/modules/FindBlocksRuntime.cmake +++ b/cmake/modules/FindBlocksRuntime.cmake @@ -45,4 +45,6 @@ if(BlocksRuntime_FOUND) INTERFACE_INCLUDE_DIRECTORIES ${BlocksRuntime_INCLUDE_DIR}) endif() +else() + set(BlocksRuntime_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/BlocksRuntime") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c88b430de..e2da3aaa8 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() From 18ef62595830ce69ccfc9353457e5efd1b64f54e Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Sun, 24 Nov 2019 21:54:36 +0100 Subject: [PATCH 2/2] build: Remove a superfluous include path --- cmake/modules/FindBlocksRuntime.cmake | 2 -- tests/CMakeLists.txt | 3 --- 2 files changed, 5 deletions(-) diff --git a/cmake/modules/FindBlocksRuntime.cmake b/cmake/modules/FindBlocksRuntime.cmake index eb3f539e9..111a5d634 100644 --- a/cmake/modules/FindBlocksRuntime.cmake +++ b/cmake/modules/FindBlocksRuntime.cmake @@ -45,6 +45,4 @@ if(BlocksRuntime_FOUND) INTERFACE_INCLUDE_DIRECTORIES ${BlocksRuntime_INCLUDE_DIR}) endif() -else() - set(BlocksRuntime_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/BlocksRuntime") endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a27603559..0af5aac87 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)