]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
CMake: Fix compatibility with CMake 3.13.
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 17 Nov 2020 18:51:48 +0000 (20:51 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 17 Nov 2020 19:09:39 +0000 (21:09 +0200)
The syntax "if(DEFINED CACHE{FOO})" requires CMake 3.14.
In some other places the code treats the cache variables
like normal variables already (${FOO} or if(FOO) is used,
not ${CACHE{FOO}).

Thanks to ygrek for reporting the bug on IRC.

CMakeLists.txt
cmake/tuklib_cpucores.cmake
cmake/tuklib_physmem.cmake

index d3aa6270e2576285dd4339552d8f365d52415ff7..c21ab567a4648c26efede48f1148bdec2bf465bf 100644 (file)
@@ -127,7 +127,7 @@ tuklib_integer(ALL)
 
 # Check for clock_gettime(). Do this before checking for threading so
 # that we know there if CLOCK_MONOTONIC is available.
-if(NOT WIN32 AND NOT DEFINED CACHE{HAVE_CLOCK_GETTIME})
+if(NOT WIN32 AND NOT DEFINED HAVE_CLOCK_GETTIME)
     check_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
     if(NOT HAVE_CLOCK_GETTIME)
         # With glibc <= 2.17 or Solaris 10 this needs librt.
index 5844e4b2742e3326b579ebb1098a8bcdb261c3ae..743d56b37cb50696e492fe2b0d3ae722a7d746b2 100644 (file)
@@ -154,12 +154,12 @@ function(tuklib_cpucores_internal_check)
 endfunction()
 
 function(tuklib_cpucores TARGET_OR_ALL)
-    if(NOT DEFINED CACHE{TUKLIB_CPUCORES_FOUND})
+    if(NOT DEFINED TUKLIB_CPUCORES_FOUND)
         message(STATUS
                 "Checking how to detect the number of available CPU cores")
         tuklib_cpucores_internal_check()
 
-        if(DEFINED CACHE{TUKLIB_CPUCORES_DEFINITIONS})
+        if(DEFINED TUKLIB_CPUCORES_DEFINITIONS)
             set(TUKLIB_CPUCORES_FOUND 1 CACHE INTERNAL "")
         else()
             set(TUKLIB_CPUCORES_FOUND 0 CACHE INTERNAL "")
index ea5bcc463316374cccef2e2ebc5bba8bfcee76db..f5ed88897679649eb1066be6899ee12ec2970caa 100644 (file)
@@ -130,11 +130,11 @@ function(tuklib_physmem_internal_check)
 endfunction()
 
 function(tuklib_physmem TARGET_OR_ALL)
-    if(NOT DEFINED CACHE{TUKLIB_PHYSMEM_FOUND})
+    if(NOT DEFINED TUKLIB_PHYSMEM_FOUND)
         message(STATUS "Checking how to detect the amount of physical memory")
         tuklib_physmem_internal_check()
 
-        if(DEFINED CACHE{TUKLIB_PHYSMEM_DEFINITIONS})
+        if(DEFINED TUKLIB_PHYSMEM_DEFINITIONS)
             set(TUKLIB_PHYSMEM_FOUND 1 CACHE INTERNAL "")
         else()
             set(TUKLIB_PHYSMEM_FOUND 0 CACHE INTERNAL "")