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 447404b3ee6ee256c0665ed4b28dc221960d7f2f
Author: Ferenc Gerlits <[email protected]>
AuthorDate: Tue Jul 26 11:08:11 2022 +0200

    MINIFICPP-1890 Fix the centos build when Kubernetes is enabled
    
    - Add a workaround for the missing SOURCE_SUBDIR option in CMake < 3.18.
    - enable the Kubernetes extension in the the centos CI build
    
    Signed-off-by: Gabor Gyimesi <[email protected]>
    
    This closes #1376
---
 .github/workflows/ci.yml      |  2 +-
 cmake/KubernetesClientC.cmake | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 21464bba6..188cb7eda 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -201,7 +201,7 @@ jobs:
           sudo apt install -y ccache
           echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
       - id: build
-        run: mkdir build && cd build && cmake -DSTRICT_GSL_CHECKS=AUDIT .. && 
make centos
+        run: mkdir build && cd build && cmake -DSTRICT_GSL_CHECKS=AUDIT 
-DENABLE_KUBERNETES=ON .. && make centos
   docker_integration_tests:
     name: "Docker integration tests"
     runs-on: ubuntu-20.04
diff --git a/cmake/KubernetesClientC.cmake b/cmake/KubernetesClientC.cmake
index 4a6959109..5e211d27f 100644
--- a/cmake/KubernetesClientC.cmake
+++ b/cmake/KubernetesClientC.cmake
@@ -41,6 +41,8 @@ FetchContent_Declare(websockets
         PATCH_COMMAND "${WEBSOCKETS_PC}"
 )
 
+FetchContent_MakeAvailable(yaml websockets)
+
 set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
 set(K8S_PATCH_FILE 
"${CMAKE_SOURCE_DIR}/thirdparty/kubernetes-client-c/remove-findpackage.patch")
 set(K8S_PC ${Bash_EXECUTABLE} -c "set -x &&\
@@ -48,10 +50,17 @@ set(K8S_PC ${Bash_EXECUTABLE} -c "set -x &&\
 FetchContent_Declare(kubernetes
     GIT_REPOSITORY https://github.com/kubernetes-client/c
     GIT_TAG 9581cd9a8426a5ad7d543b146d5c5ede37cc32e0  # latest commit on 
master as of 2022-01-05
-    SOURCE_SUBDIR kubernetes
     PATCH_COMMAND "${K8S_PC}"
 )
 
-FetchContent_MakeAvailable(yaml websockets kubernetes)
+# With CMake >= 3.18, this block could be replaced with 
FetchContent_MakeAvailable(kubernetes),
+# if we add the `SOURCE_SUBDIR kubernetes` option to FetchContent_Declare() 
[this option is not available in CMake < 3.18].
+# As of July 2022, one of our supported platforms, Centos 7, comes with CMake 
3.17.
+FetchContent_GetProperties(kubernetes)
+if(NOT kubernetes_POPULATED)
+    FetchContent_Populate(kubernetes)
+    # the top level doesn't contain CMakeLists.txt, it is in the "kubernetes" 
subdirectory
+    add_subdirectory(${kubernetes_SOURCE_DIR}/kubernetes 
${kubernetes_BINARY_DIR})
+endif()
 
 add_dependencies(websockets CURL::libcurl OpenSSL::Crypto OpenSSL::SSL)

Reply via email to