From 124e9c184c234eac8826ed18b76ee9ae762bccef Mon Sep 17 00:00:00 2001 From: Dusan Baran Date: Wed, 3 Apr 2024 12:28:12 +0200 Subject: [PATCH] Only link rt for Linux --- ports/libfaketime/CMakeLists.txt | 10 ++++++---- test/CMakeLists.txt | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ports/libfaketime/CMakeLists.txt b/ports/libfaketime/CMakeLists.txt index 59828fe7595..bfb9de96abd 100644 --- a/ports/libfaketime/CMakeLists.txt +++ b/ports/libfaketime/CMakeLists.txt @@ -7,10 +7,12 @@ add_library( src/libfaketime.c ) -target_link_libraries( - ${PROJECT_NAME} - rt -) +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + target_link_libraries( + ${PROJECT_NAME} + rt + ) +endif() target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 48306a579f6..9f8563c213e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -362,8 +362,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU ) endif() -# Only produce timing tests for Linux based systems (faketime constraint) -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") +# Only produce timing tests for UNIX based systems (faketime constraint) +if (NOT MSVC) find_package(unofficial-libfaketime REQUIRED) # unit test executable