Skip to content

Commit 9533991

Browse files
committed
Fix Paho C build
1 parent 1980bd3 commit 9533991

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "src/externals/paho-mqtt-c"]
22
path = src/externals/paho-mqtt-c
3-
url = https://github.com/eclipse/paho.mqtt.c.git
3+
url = ../paho.mqtt.c.git

CMakeLists.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
# All rights reserved. This program and the accompanying materials
1212
# are made available under the terms of the Eclipse Public License v2.0
1313
# and Eclipse Distribution License v1.0 which accompany this distribution.
14-
#
14+
#
1515
# The Eclipse Public License is available at
1616
# http://www.eclipse.org/legal/epl-v20.html
1717
# and the Eclipse Distribution License is available at
1818
# http://www.eclipse.org/org/documents/edl-v10.php.
19-
#
19+
#
2020
# Contributors:
2121
# Guilherme Maciel Ferreira - initial version
2222
# Frank Pagliughi
@@ -50,14 +50,25 @@ endif()
5050

5151
## --- Find Paho C or build it, if reqested ---
5252

53+
if(PAHO_WITH_SSL)
54+
find_package(OpenSSL REQUIRED)
55+
set(PAHO_MQTT_C_LIB paho-mqtt3as)
56+
else()
57+
set(PAHO_MQTT_C_LIB paho-mqtt3a)
58+
endif()
59+
60+
if(PAHO_BUILD_STATIC AND NOT PAHO_BUILD_SHARED)
61+
set(PAHO_MQTT_C_LIB ${PAHO_MQTT_C_LIB}-static)
62+
endif()
63+
5364
if(PAHO_WITH_MQTT_C)
5465
message(STATUS "Paho C: Bundled")
5566

5667
## Build the Paho C library from the submodule
5768
set(PAHO_ENABLE_TESTING FALSE CACHE BOOL "No Paho C tests")
5869
set(PAHO_HIGH_PERFORMANCE TRUE CACHE BOOL "Paho C high performance")
5970

60-
add_subdirectory(${PROJECT_SOURCE_DIR}/externals/paho-mqtt-c)
71+
add_subdirectory(${PROJECT_SOURCE_DIR}/src/externals/paho-mqtt-c EXCLUDE_FROM_ALL)
6172

6273
## Alias namespace so that the full names can be used with the subdir.
6374
if(PAHO_BUILD_SHARED)
@@ -83,16 +94,7 @@ else()
8394
find_package(eclipse-paho-mqtt-c REQUIRED)
8495
endif()
8596

86-
if(PAHO_WITH_SSL)
87-
find_package(OpenSSL REQUIRED)
88-
set(PAHO_MQTT_C_LIB eclipse-paho-mqtt-c::paho-mqtt3as)
89-
else()
90-
set(PAHO_MQTT_C_LIB eclipse-paho-mqtt-c::paho-mqtt3a)
91-
endif()
92-
93-
if(PAHO_BUILD_STATIC AND NOT PAHO_BUILD_SHARED)
94-
set(PAHO_MQTT_C_LIB ${PAHO_MQTT_C_LIB}-static)
95-
endif()
97+
set(PAHO_MQTT_C_LIB "eclipse-paho-mqtt-c::${PAHO_MQTT_C_LIB}")
9698

9799
## --- C++11 build flags ---
98100

@@ -161,4 +163,3 @@ endif()
161163
include(CPack)
162164

163165
add_subdirectory(cmake)
164-

0 commit comments

Comments
 (0)