11
11
# All rights reserved. This program and the accompanying materials
12
12
# are made available under the terms of the Eclipse Public License v2.0
13
13
# and Eclipse Distribution License v1.0 which accompany this distribution.
14
- #
14
+ #
15
15
# The Eclipse Public License is available at
16
16
# http://www.eclipse.org/legal/epl-v20.html
17
17
# and the Eclipse Distribution License is available at
18
18
# http://www.eclipse.org/org/documents/edl-v10.php.
19
- #
19
+ #
20
20
# Contributors:
21
21
# Guilherme Maciel Ferreira - initial version
22
22
# Frank Pagliughi
@@ -50,27 +50,28 @@ endif()
50
50
51
51
## --- Find Paho C or build it, if reqested ---
52
52
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
+
53
64
if (PAHO_WITH_MQTT_C )
54
65
message (STATUS "Paho C: Bundled" )
55
66
56
67
## Build the Paho C library from the submodule
57
68
set (PAHO_ENABLE_TESTING FALSE CACHE BOOL "No Paho C tests" )
58
69
set (PAHO_HIGH_PERFORMANCE TRUE CACHE BOOL "Paho C high performance" )
59
70
60
- add_subdirectory (${PROJECT_SOURCE_DIR} /externals/paho-mqtt-c )
61
-
62
- ## Alias namespace so that the full names can be used with the subdir.
63
- if (PAHO_BUILD_SHARED )
64
- add_library (eclipse-paho-mqtt-c::paho-mqtt3a ALIAS paho-mqtt3a )
65
- if (PAHO_WITH_SSL )
66
- add_library (eclipse-paho-mqtt-c::paho-mqtt3as ALIAS paho-mqtt3as )
67
- endif ()
68
- else ()
69
- # Seems that the C lib
70
- add_library (eclipse-paho-mqtt-c::paho-mqtt3a-static ALIAS paho-mqtt3a-static )
71
- if (PAHO_WITH_SSL )
72
- add_library (eclipse-paho-mqtt-c::paho-mqtt3as-static ALIAS paho-mqtt3as-static )
73
- endif ()
71
+ add_subdirectory (${PROJECT_SOURCE_DIR} /src/externals/paho-mqtt-c EXCLUDE_FROM_ALL )
72
+
73
+ if (NOT TARGET ${PAHO_MQTT_C_LIB} )
74
+ message (FATAL_ERROR "${PAHO_MQTT_C_LIB} not found in Paho C build" )
74
75
endif ()
75
76
76
77
## install paho.mqtt.c library (appending to PahoMqttCpp export)
@@ -83,17 +84,6 @@ else()
83
84
find_package (eclipse-paho-mqtt-c REQUIRED )
84
85
endif ()
85
86
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 ()
96
-
97
87
## --- C++11 build flags ---
98
88
99
89
set (CMAKE_CXX_STANDARD 11 )
@@ -161,4 +151,3 @@ endif()
161
151
include (CPack )
162
152
163
153
add_subdirectory (cmake )
164
-
0 commit comments