]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: use a loop for setting new policies
authorKefu Chai <tchaikov@gmail.com>
Sat, 27 Aug 2022 01:47:44 +0000 (09:47 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 27 Aug 2022 01:49:27 +0000 (09:49 +0800)
we were using a for loop for this purpose, but the for loop was unrolled
when we bumped up the required cmake version.

this change paves the road to setting "CMP0135" to "NEW". this policy
is a new one introduced by CMake v3.24.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
CMakeLists.txt

index 40c8b63425814ad3886995df48926e80523a0ac7..df17fed6b15280ed8b1ecfb31363df4c1760b9cb 100644 (file)
@@ -14,8 +14,10 @@ cmake_policy(SET CMP0065 NEW)
 cmake_policy(SET CMP0074 NEW)
 cmake_policy(SET CMP0075 NEW)
 cmake_policy(SET CMP0093 NEW)
-if(POLICY CMP0127)
-  cmake_policy(SET CMP0127 NEW)
+foreach(policy CMP0127)
+  if(POLICY ${policy})
+    cmake_policy(SET ${policy} NEW)
+  endif()
 endif()
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")