You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by lo...@apache.org on 2023/01/17 15:14:07 UTC

[nifi-minifi-cpp] 02/03: MINIFICPP-2025 Eliminate cmake CMP0135 warnings

This is an automated email from the ASF dual-hosted git repository.

lordgamez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 63c4eb9e97e50c6456006501c6e254c5b21dc933
Author: Martin Zink <ma...@apache.org>
AuthorDate: Wed Dec 21 12:59:03 2022 +0100

    MINIFICPP-2025 Eliminate cmake CMP0135 warnings
    
    Added bootstrap.sh support for Rocky/Alma linux 9
    
    Signed-off-by: Gabor Gyimesi <ga...@gmail.com>
    
    This closes #1487
---
 CMakeLists.txt                                     |  4 +++
 bootstrap.sh                                       | 16 ++---------
 centos.sh                                          |  1 +
 cmake/BundledLibXml2.cmake                         |  4 +++
 .../bustache/CMakeLists.txt => cmake/Crc32c.cmake  | 32 ++++++++--------------
 cmake/FindLibGPS.cmake                             | 12 ++++----
 cmake/GoogleCloudCpp.cmake                         | 13 +--------
 extensions/bustache/CMakeLists.txt                 |  1 -
 libminifi/CMakeLists.txt                           |  3 ++
 9 files changed, 34 insertions(+), 52 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b049ec65e..31d1a3d7c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,10 @@
 cmake_minimum_required(VERSION 3.17)
 cmake_policy(SET CMP0096 NEW) # policy to preserve the leading zeros in PROJECT_VERSION_{MAJOR,MINOR,PATCH,TWEAK}
 cmake_policy(SET CMP0065 OLD) # default export policy, required for self-dlopen
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
+    cmake_policy(SET CMP0135 NEW) # policy to set the timestamps of extracted contents to the time of extraction
+endif()
+
 project(nifi-minifi-cpp VERSION 0.13.0)
 set(PROJECT_NAME "nifi-minifi-cpp")
 
diff --git a/bootstrap.sh b/bootstrap.sh
index cd4f9e8b3..719d40c9e 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -194,11 +194,7 @@ else
   . "${script_directory}/linux.sh"
   if [[ "$OS" = Deb* ]]; then
     . "${script_directory}/debian.sh"
-  elif [[ "$OS" = Rasp* ]]; then
-    . "${script_directory}/aptitude.sh"
-  elif [[ "$OS" = Pop* ]]; then
-    . "${script_directory}/aptitude.sh"
-  elif [[ "$OS" = Ubuntu* ]]; then
+  elif [[ "$OS" = Ubuntu* || "$OS" = Rasp* || "$OS" = Pop* ]]; then
     . "${script_directory}/aptitude.sh"
   elif [[ "$OS" = *SUSE* ]]; then
     . "${script_directory}/suse.sh"
@@ -211,17 +207,11 @@ else
     fi
   elif [[ "$OS" = Red* ]]; then
     . "${script_directory}/rheldistro.sh"
-  elif [[ "$OS" = Amazon* ]]; then
-    . "${script_directory}/centos.sh"
-  elif [[ "$OS" = Rocky* ]]; then
-    . "${script_directory}/centos.sh"
-  elif [[ "$OS" = CentOS* ]]; then
+  elif [[ "$OS" = Amazon* || "$OS" = Alma* || "$OS" = Rocky* || "$OS" = CentOS* ]]; then
     . "${script_directory}/centos.sh"
   elif [[ "$OS" = Fedora* ]]; then
     . "${script_directory}/fedora.sh"
-  elif [[ "$OS" = Manjaro* ]]; then
-    . "${script_directory}/arch.sh"
-  elif [[ "$OS" = Arch* ]]; then
+  elif [[ "$OS" = Arch* || "$OS" = Manjaro* ]]; then
     . "${script_directory}/arch.sh"
   fi
 fi
diff --git a/centos.sh b/centos.sh
index e506f21b8..a01482273 100644
--- a/centos.sh
+++ b/centos.sh
@@ -20,6 +20,7 @@ get_toolset_name() {
     case "$OS_MAJOR" in
         7) TOOLSET_NAME=devtoolset-10 ;;
         8) TOOLSET_NAME=gcc-toolset-10 ;;
+        9) TOOLSET_NAME=gcc-toolset-12 ;;
     esac
 }
 
diff --git a/cmake/BundledLibXml2.cmake b/cmake/BundledLibXml2.cmake
index 9405196d8..b5de5503b 100644
--- a/cmake/BundledLibXml2.cmake
+++ b/cmake/BundledLibXml2.cmake
@@ -38,6 +38,10 @@ function(use_bundled_libxml2 SOURCE_DIR BINARY_DIR)
                 "-DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/libxml2-install")
     endif()
 
+    if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
+        cmake_policy(SET CMP0135 OLD) # Restore the timestamps from the archive https://gitlab.kitware.com/cmake/cmake/-/issues/24003
+    endif()
+
     # Build project
     set(LIBXML2_URL ftp://xmlsoft.org/libxml2/libxml2-2.9.10.tar.gz https://ftp.osuosl.org/pub/blfs/conglomeration/libxml2/libxml2-2.9.10.tar.gz)
     set(LIBXML2_URL_HASH "SHA256=aafee193ffb8fe0c82d4afef6ef91972cbaf5feea100edc2f262750611b4be1f")
diff --git a/extensions/bustache/CMakeLists.txt b/cmake/Crc32c.cmake
similarity index 53%
copy from extensions/bustache/CMakeLists.txt
copy to cmake/Crc32c.cmake
index 3d800fa5e..b582aaead 100644
--- a/extensions/bustache/CMakeLists.txt
+++ b/cmake/Crc32c.cmake
@@ -16,23 +16,15 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-
-if (NOT ENABLE_BUSTACHE)
-    return()
-endif()
-
-include(BundledBustache)
-use_bundled_bustache(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
-
-include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt)
-cmake_minimum_required(VERSION 2.6)
-
-file(GLOB SOURCES "*.cpp")
-
-add_library(minifi-bustache-extensions SHARED ${SOURCES})
-
-target_link_libraries(minifi-bustache-extensions ${LIBMINIFI})
-target_link_libraries(minifi-bustache-extensions BUSTACHE::libbustache)
-
-register_extension(minifi-bustache-extensions "BUSTACHE EXTENSIONS" BUSTACHE-EXTENSIONS "This enables bustache functionality including ApplyTemplate." "${TEST_DIR}/bustache-tests")
-register_extension_linter(minifi-bustache-extensions-linter)
+include(FetchContent)
+set(CRC32C_USE_GLOG OFF CACHE INTERNAL crc32c-glog-off)
+set(CRC32C_BUILD_TESTS OFF CACHE INTERNAL crc32c-gtest-off)
+set(CRC32C_BUILD_BENCHMARKS OFF CACHE INTERNAL crc32-benchmarks-off)
+set(CRC32C_INSTALL ON CACHE INTERNAL crc32-install-on)
+FetchContent_Declare(
+        crc32c
+        URL     https://github.com/google/crc32c/archive/refs/tags/1.1.1.tar.gz
+        URL_HASH SHA256=a6533f45b1670b5d59b38a514d82b09c6fb70cc1050467220216335e873074e8
+)
+FetchContent_MakeAvailable(crc32c)
+add_library(Crc32c::crc32c ALIAS crc32c)
diff --git a/cmake/FindLibGPS.cmake b/cmake/FindLibGPS.cmake
index ec109b6db..857df86ef 100644
--- a/cmake/FindLibGPS.cmake
+++ b/cmake/FindLibGPS.cmake
@@ -5,9 +5,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -31,20 +31,20 @@ find_path(LIBGPS_INCLUDE_DIR
     DOC "LIBGPS include header"
 )
 
-find_library(LIBGPS_LIBRARY 
+find_library(LIBGPS_LIBRARY
     NAMES libgps.so libgps.dylib
     PATHS /usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/arm-linux-gnueabihf
     DOC "LIBGPS library"
 )
 
-find_library(LIBGPS_STATIC_LIBRARY 
+find_library(LIBGPS_STATIC_LIBRARY
     NAMES libgps.a
     PATHS /usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/arm-linux-gnueabihf
     DOC "LIBGPS Static library"
 )
 
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(LIBGPS DEFAULT_MSG LIBGPS_INCLUDE_DIR LIBGPS_LIBRARY)
+find_package_handle_standard_args(LibGPS DEFAULT_MSG LIBGPS_INCLUDE_DIR LIBGPS_LIBRARY)
 
 if (LIBGPS_FOUND)
     set(LIBGPS_LIBRARIES ${LIBGPS_LIBRARY} )
@@ -52,4 +52,4 @@ if (LIBGPS_FOUND)
     set(LIBGPS_DEFINITIONS )
 endif()
 
-mark_as_advanced(LIBGPS_ROOT_DIR LIBGPS_INCLUDE_DIR LIBGPS_LIBRARY LIBGPS_STATIC_LIBRARY)
\ No newline at end of file
+mark_as_advanced(LIBGPS_ROOT_DIR LIBGPS_INCLUDE_DIR LIBGPS_LIBRARY LIBGPS_STATIC_LIBRARY)
diff --git a/cmake/GoogleCloudCpp.cmake b/cmake/GoogleCloudCpp.cmake
index 71d08c4c2..3efabb55c 100644
--- a/cmake/GoogleCloudCpp.cmake
+++ b/cmake/GoogleCloudCpp.cmake
@@ -18,18 +18,7 @@
 #
 include(FetchContent)
 include(Abseil)
-
-set(CRC32C_USE_GLOG OFF CACHE INTERNAL crc32c-glog-off)
-set(CRC32C_BUILD_TESTS OFF CACHE INTERNAL crc32c-gtest-off)
-set(CRC32C_BUILD_BENCHMARKS OFF CACHE INTERNAL crc32-benchmarks-off)
-set(CRC32C_INSTALL ON CACHE INTERNAL crc32-install-on)
-FetchContent_Declare(
-        crc32c
-        URL     https://github.com/google/crc32c/archive/refs/tags/1.1.1.tar.gz
-        URL_HASH SHA256=a6533f45b1670b5d59b38a514d82b09c6fb70cc1050467220216335e873074e8
-)
-FetchContent_MakeAvailable(crc32c)
-add_library(Crc32c::crc32c ALIAS crc32c)
+include(Crc32c)
 
 set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/remove-find_package.patch")
 set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/nlohmann_lib_as_interface.patch")
diff --git a/extensions/bustache/CMakeLists.txt b/extensions/bustache/CMakeLists.txt
index 3d800fa5e..3e130dd4b 100644
--- a/extensions/bustache/CMakeLists.txt
+++ b/extensions/bustache/CMakeLists.txt
@@ -25,7 +25,6 @@ include(BundledBustache)
 use_bundled_bustache(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
 
 include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt)
-cmake_minimum_required(VERSION 2.6)
 
 file(GLOB SOURCES "*.cpp")
 
diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt
index f4bbee6f8..354e944e2 100644
--- a/libminifi/CMakeLists.txt
+++ b/libminifi/CMakeLists.txt
@@ -19,6 +19,9 @@
 
 cmake_minimum_required (VERSION 3.16)
 cmake_policy(SET CMP0096 NEW) # policy to preserve the leading zeros in PROJECT_VERSION_{MAJOR,MINOR,PATCH,TWEAK}
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
+    cmake_policy(SET CMP0135 NEW) # policy to set the timestamps of extracted contents to the time of extraction
+endif()
 project(nifi-libcore-minifi VERSION 0.13.0)
 set(PROJECT_NAME "nifi-libcore-minifi")