]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
CMake: Fix unconditionally defining HAVE_CLOCK_MONOTONIC.
authorJia Tan <jiat0218@gmail.com>
Tue, 12 Sep 2023 14:34:06 +0000 (22:34 +0800)
committerJia Tan <jiat0218@gmail.com>
Tue, 12 Sep 2023 14:34:06 +0000 (22:34 +0800)
If HAVE_CLOCK_GETTIME was defined, then HAVE_CLOCK_MONOTONIC was always
added as a compile definition even if the check for it failed.

CMakeLists.txt

index c69b135edad186848da1207846cdbe4e18699414..63dd59f7f80791ce53db54442a3c590bf6fef94e 100644 (file)
@@ -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()