aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-09-12 22:34:06 +0800
committerJia Tan <jiat0218@gmail.com>2023-10-31 01:03:25 +0800
commitd5275d83bd2a9701c5feb8666785007c074b1359 (patch)
tree3caf18e72ca51e512f7ab7ac16e84849ab983f0a /CMakeLists.txt
parentxz: Refactor thousand separator detection and disable it on MSVC. (diff)
downloadxz-d5275d83bd2a9701c5feb8666785007c074b1359.tar.xz
CMake: Fix unconditionally defining HAVE_CLOCK_MONOTONIC.
If HAVE_CLOCK_GETTIME was defined, then HAVE_CLOCK_MONOTONIC was always added as a compile definition even if the check for it failed.
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt8
1 files changed, 3 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3a6ef5c..f17fe081 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -168,13 +168,11 @@ if(NOT WIN32 AND NOT DEFINED HAVE_CLOCK_GETTIME)
endif()
endif()
if(HAVE_CLOCK_GETTIME)
+ add_compile_definitions(HAVE_CLOCK_GETTIME)
+
# Check if CLOCK_MONOTONIC is available for clock_gettime().
check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_CLOCK_MONOTONIC)
-
- add_compile_definitions(
- HAVE_CLOCK_GETTIME
- HAVE_CLOCK_MONOTONIC
- )
+ tuklib_add_definition_if(ALL HAVE_CLOCK_MONOTONIC)
endif()
endif()