From d2be018800beeb59f8781113947cd56bf5e41399 Mon Sep 17 00:00:00 2001 From: skicc Date: Sat, 15 Jun 2019 21:48:32 +0800 Subject: [PATCH] CMake: don't try to link with librt on MinGW On MinGW, librt will might will found as rt library in MSYS, but fails linking with "cannot find -lrt" error. As librt is not avaiable on native Windows, we should never try to link with -lrt on MinGW (which is native Windows). --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08b5a151..8eb3411f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,9 +362,11 @@ else() check_cxx_symbol_exists(LOCAL_PEERCRED sys/socket.h ZMQ_HAVE_LOCAL_PEERCRED) endif() -find_library(RT_LIBRARY rt) -if(RT_LIBRARY) - set(pkg_config_libs_private "${pkg_config_libs_private} -lrt") +if(NOT MINGW) + find_library(RT_LIBRARY rt) + if(RT_LIBRARY) + set(pkg_config_libs_private "${pkg_config_libs_private} -lrt") + endif() endif() find_package(Threads)