Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions recipes/mosquitto/2.x/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sources:
"2.0.22":
url: "https://github.com/eclipse-mosquitto/mosquitto/archive/refs/tags/v2.0.22.tar.gz"
sha256: "a2850bd168cd9f1baa954c30994167f9f8c54ee4966ef34738620a48f63657d5"
"2.1.2":
url: "https://github.com/eclipse-mosquitto/mosquitto/archive/refs/tags/v2.1.2.tar.gz"
sha256: "20e998aae86d1629e787a924c044bb912d21ac8f5d1c1b707f2af06eb4c6016d"
24 changes: 21 additions & 3 deletions recipes/mosquitto/2.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def config_options(self):
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
if not self.options.clients:
# mosquitto 2.1 requires cJSON unconditionally (libmosquitto_common),
# so only tie cjson to clients for older versions.
if not self.options.clients and Version(self.version) < "2.1":
self.options.rm_safe("cjson")
if not self.options.broker:
self.options.rm_safe("websockets")
Expand All @@ -65,7 +67,7 @@ def layout(self):
def requirements(self):
if self.options.ssl:
self.requires("openssl/[>=1.1 <4]")
if self.options.get_safe("cjson"):
if self.options.get_safe("cjson") or Version(self.version) >= "2.1":
self.requires("cjson/1.7.16")
if self.options.get_safe("websockets"):
self.requires("libwebsockets/4.3.2")
Expand All @@ -83,6 +85,12 @@ def generate(self):
deps = CMakeDeps(self)
if self.options.get_safe("threading") and self.settings.os == "Windows" and Version(self.version) >= "2.0.21":
deps.set_property("pthreads4w", "cmake_target_aliases", ["PThreads4W::PThreads4W"])
if Version(self.version) >= "2.1":
# mosquitto 2.1 links a bare `cJSON` target (see libcommon/CMakeLists.txt),
# which is normally provided by its bundled cmake/FindcJSON.cmake. Alias
# Conan's cjson target to that name so the include dirs propagate when the
# Conan config package is used instead of the module finder.
deps.set_property("cjson", "cmake_target_aliases", ["cJSON"])
deps.generate()

tc = CMakeToolchain(self)
Expand All @@ -105,9 +113,19 @@ def generate(self):
tc.variables["WITH_THREADING"] = self.options.threading
tc.variables["WITH_WEBSOCKETS"] = self.options.get_safe("websockets", False)
tc.variables["STATIC_WEBSOCKETS"] = self.options.get_safe("websockets", False) and not self.dependencies["libwebsockets"].options.shared
tc.variables["DOCUMENTATION"] = False
tc.variables["WITH_DOCS"] = False
tc.variables["WITH_TESTS"] = False
tc.variables["CMAKE_INSTALL_SYSCONFDIR"] = os.path.join(self.package_folder, "res").replace("\\", "/")
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
if Version(self.version) >= "2.1":
# mosquitto 2.1's static library target (libmosquitto_static) omits the
# bundled-deps include dir that only the shared target adds via
# `if(WITH_BUNDLED_DEPS)` in lib/CMakeLists.txt. As a result headers like
# utlist.h/uthash.h from deps/ aren't found when building the static lib.
# Add the include dir explicitly for all targets.
deps_dir = os.path.join(self.source_folder, "deps").replace("\\", "/")
tc.extra_cflags.append(f"-I{deps_dir}")
tc.extra_cxxflags.append(f"-I{deps_dir}")
tc.generate()

def build(self):
Expand Down
2 changes: 1 addition & 1 deletion recipes/mosquitto/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
versions:
"2.0.22":
"2.1.2":
folder: "2.x"
"1.6.12":
folder: "1.x"