From d1ff103259bf44047b0da458cbd22d5e66a70773 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Fri, 7 Jul 2023 19:36:22 -0400 Subject: [PATCH] Make linking librt conditional on it containing shm_open Fixes building on UNIX platforms with no librt. Co-authored-by: Nadia Holmquist Pedersen --- src/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9676e2f0..210e280d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -131,7 +131,10 @@ endif() if (WIN32) target_link_libraries(core PRIVATE ole32 comctl32 ws2_32) elseif(NOT APPLE) - target_link_libraries(core PRIVATE rt) + check_library_exists(rt shm_open "" NEED_LIBRT) + if (NEED_LIBRT) + target_link_libraries(core PRIVATE rt) + endif() endif() if (ENABLE_JIT_PROFILING)