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



##########
File path: cmake/PahoMqttC.cmake
##########
@@ -0,0 +1,58 @@
+# 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 build options
+set(PAHO_BUILD_STATIC ON CACHE BOOL "" FORCE)
+set(PAHO_BUILD_SHARED OFF CACHE BOOL "" FORCE)
+set(PAHO_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
+
+if (OPENSSL_OFF)
+    set(PAHO_WITH_SSL OFF CACHE BOOL "" FORCE)
+else()
+    set(PAHO_WITH_SSL ON CACHE BOOL "" FORCE)
+endif()
+
+FetchContent_Declare(
+    paho.mqtt.c-external
+    GIT_REPOSITORY "https://github.com/eclipse/paho.mqtt.c.git";
+    GIT_TAG "3b7ae6348bc917d42c04efa962e4868c09bbde9f" # Once tagged as v1.3.9 
release, but tags may move

Review comment:
       It would be better to download the release tarball. Download + extract 
is faster than git clone.

##########
File path: cmake/PahoMqttC.cmake
##########
@@ -0,0 +1,58 @@
+# 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 build options
+set(PAHO_BUILD_STATIC ON CACHE BOOL "" FORCE)
+set(PAHO_BUILD_SHARED OFF CACHE BOOL "" FORCE)
+set(PAHO_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
+
+if (OPENSSL_OFF)
+    set(PAHO_WITH_SSL OFF CACHE BOOL "" FORCE)
+else()
+    set(PAHO_WITH_SSL ON CACHE BOOL "" FORCE)
+endif()
+
+FetchContent_Declare(
+    paho.mqtt.c-external
+    GIT_REPOSITORY "https://github.com/eclipse/paho.mqtt.c.git";
+    GIT_TAG "3b7ae6348bc917d42c04efa962e4868c09bbde9f" # Once tagged as v1.3.9 
release, but tags may move
+)
+
+FetchContent_MakeAvailable(paho.mqtt.c-external)
+
+# Set dependencies and target to link to
+if (NOT OPENSSL_OFF)
+    # workaround

Review comment:
       What issue are you working around here?

##########
File path: cmake/PahoMqttC.cmake
##########
@@ -0,0 +1,58 @@
+# 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 build options
+set(PAHO_BUILD_STATIC ON CACHE BOOL "" FORCE)
+set(PAHO_BUILD_SHARED OFF CACHE BOOL "" FORCE)
+set(PAHO_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
+
+if (OPENSSL_OFF)
+    set(PAHO_WITH_SSL OFF CACHE BOOL "" FORCE)
+else()
+    set(PAHO_WITH_SSL ON CACHE BOOL "" FORCE)
+endif()
+
+FetchContent_Declare(
+    paho.mqtt.c-external
+    GIT_REPOSITORY "https://github.com/eclipse/paho.mqtt.c.git";
+    GIT_TAG "3b7ae6348bc917d42c04efa962e4868c09bbde9f" # Once tagged as v1.3.9 
release, but tags may move
+)
+
+FetchContent_MakeAvailable(paho.mqtt.c-external)
+
+# Set dependencies and target to link to
+if (NOT OPENSSL_OFF)
+    # workaround
+    if(TARGET paho-mqtt3cs)
+        # this is selected for the first configure run
+        add_library(paho.mqtt.c ALIAS paho-mqtt3cs)
+    else()
+        # this is selected for further configure runs
+        add_library(paho.mqtt.c ALIAS paho-mqtt3cs-static)

Review comment:
       Are we building both static and shared libraries now? Previously it was 
static only.

##########
File path: cmake/BundledPahoMqttC.cmake
##########
@@ -1,78 +0,0 @@
-# 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.
-
-function(use_bundled_pahomqttc SOURCE_DIR BINARY_DIR)
-    # Define patch step
-    set(PATCH_FILE "${SOURCE_DIR}/thirdparty/paho.mqtt.c/paho.mqtt.c.patch")
-    set(PAHO_MQTT_C_PATCH_COMMAND "${Patch_EXECUTABLE}" -p1 -R -s -f --dry-run 
-i "${PATCH_FILE}" || "${Patch_EXECUTABLE}" -p1 -N -i "${PATCH_FILE}")
-
-    # Define byproducts
-    if (WIN32)
-        set(BYPRODUCT "lib/libpaho-mqtt3cs-static.lib")
-    else()
-        include(GNUInstallDirs)
-        set(BYPRODUCT "${CMAKE_INSTALL_LIBDIR}/libpaho-mqtt3cs.a")
-    endif()
-
-    # Set build options
-    set(PAHOMQTTC_CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
-            
"-DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/paho.mqtt.c-install"
-            -DPAHO_BUILD_STATIC=TRUE
-            -DPAHO_BUILD_SHARED=FALSE

Review comment:
       Any way to build a static library instead of shared?




-- 
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