diff options
author | Jia Tan <jiat0218@gmail.com> | 2022-12-29 01:10:53 +0800 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-01-05 00:26:35 +0800 |
commit | 9e3cb514b5b95bd235dcdff3db4436f57444ee4f (patch) | |
tree | 28638a49752e60d16d877672869910d392d1e193 /CMakeLists.txt | |
parent | Translations: Add Ukrainian translations of man pages. (diff) | |
download | xz-9e3cb514b5b95bd235dcdff3db4436f57444ee4f.tar.xz |
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.txt | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 01c73cd5..c4f10594 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) |