szaszm commented on a change in pull request #1268:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1268#discussion_r823843635



##########
File path: cmake/GoogleCloudCpp.cmake
##########
@@ -0,0 +1,63 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# 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
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+include(FetchContent)
+set(NLOHMANN_JSON_INCLUDE_DIR "${CMAKE_BINARY_DIR}/_deps/nlohmann/" CACHE 
STRING "" FORCE)
+if(NOT EXISTS "${NLOHMANN_JSON_INCLUDE_DIR}/nlohmann/json.hpp")
+    file(DOWNLOAD 
"https://github.com/nlohmann/json/releases/download/v3.10.5/json.hpp"; 
"${NLOHMANN_JSON_INCLUDE_DIR}/nlohmann/json.hpp"
+            EXPECTED_HASH 
SHA256=e832d339d9e0c042e7dff807754769d778cf5d6ae9730ce21eed56de99cb5e86)
+endif()
+set(GOOGLE_CLOUD_CPP_NLOHMANN_JSON_HEADER ${NLOHMANN_JSON_INCLUDE_DIR})
+
+set(ABSL_PROPAGATE_CXX_STD ON CACHE INTERNAL absl-propagate-cxx)
+set(ABSL_ENABLE_INSTALL ON CACHE INTERNAL "")
+FetchContent_Declare(
+        absl
+        URL      
https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz
+        URL_HASH 
SHA256=dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4
+)
+FetchContent_MakeAvailable(absl)
+
+
+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)
+
+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")
+set(PC ${Bash_EXECUTABLE} -c "set -x &&\
+        (\\\"${Patch_EXECUTABLE}\\\" -R -p1 -s -f --dry-run -i ${PATCH_FILE_1} 
|| \\\"${Patch_EXECUTABLE}\\\" -p1 -i ${PATCH_FILE_1}) &&\
+        (\\\"${Patch_EXECUTABLE}\\\" -R -p1 -s -f --dry-run -i ${PATCH_FILE_2} 
|| \\\"${Patch_EXECUTABLE}\\\" -p1 -i ${PATCH_FILE_2})")

Review comment:
       I think these are too many backslashes. We need to escape the quote in 
cmake, so that it ends up in bash and makes it work even if there is space in 
the patch executable path, but it doesn't need to escape from bash to the 
filename.
   We also need to escape the patch file path. Check out BundledAwsSdkCpp.cmake 
for example. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to