summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2022-12-29 01:10:53 +0800
committerJia Tan <jiat0218@gmail.com>2022-12-30 23:34:31 +0800
commit74dae7d30091e906d6a92a57952dea4354473f9b (patch)
tree128a776f1c62de4504aa5e6448c9ec3fc130d211 /CMakeLists.txt
parent7339e39dc060df6eda74a2c5b69961befc3d5d24 (diff)
downloadxz-74dae7d30091e906d6a92a57952dea4354473f9b.tar.gz
Build: No longer require HAVE_DECL_CLOCK_MONOTONIC to always be set.
Previously, if threading was enabled HAVE_DECL_CLOCK_MONOTONIC would always be set to 0 or 1. However, this macro was needed in xz so if xz was not built with threading and HAVE_DECL_CLOCK_MONOTONIC was not defined but HAVE_CLOCK_GETTIME was, it caused a warning during build. Now, HAVE_DECL_CLOCK_MONOTONIC has been renamed to HAVE_CLOCK_MONOTONIC and will only be set if it is 1.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 3 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01c73cd..c4f1059 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,13 +154,11 @@ if(NOT WIN32 AND NOT DEFINED HAVE_CLOCK_GETTIME)
endif()
if(HAVE_CLOCK_GETTIME)
# Check if CLOCK_MONOTONIC is available for clock_gettime().
- check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_DECL_CLOCK_MONOTONIC)
+ check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_CLOCK_MONOTONIC)
- # HAVE_DECL_CLOCK_MONOTONIC should always be defined to 0 or 1
- # when clock_gettime is available.
add_compile_definitions(
HAVE_CLOCK_GETTIME
- HAVE_DECL_CLOCK_MONOTONIC=$<BOOL:"${HAVE_DECL_CLOCK_MONOTONIC}">
+ HAVE_CLOCK_MONOTONIC
)
endif()
endif()
@@ -184,7 +182,7 @@ else()
add_compile_definitions(MYTHREAD_POSIX)
# Check if pthread_condattr_setclock() exists to use CLOCK_MONOTONIC.
- if(HAVE_DECL_CLOCK_MONOTONIC)
+ if(HAVE_CLOCK_MONOTONIC)
list(INSERT CMAKE_REQUIRED_LIBRARIES 0 "${CMAKE_THREAD_LIBS_INIT}")
check_symbol_exists(pthread_condattr_setclock pthread.h
HAVE_PTHREAD_CONDATTR_SETCLOCK)