Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

civetweb: Add missing CMake options #9303

Merged
merged 5 commits into from
Feb 14, 2022
Merged
Changes from 2 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
17 changes: 13 additions & 4 deletions recipes/civetweb/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def _source_subfolder(self):
def _build_subfolder(self):
return "build_subfolder"

@property
def _has_zlib_option(self):
return tools.Version(self.version) >= "1.15"

def export_sources(self):
self.copy("CMakeLists.txt")
for patch in self.conan_data.get("patches", {}).get(self.version, []):
Expand All @@ -67,6 +71,8 @@ def export_sources(self):
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if not self._has_zlib_option:
del self.options.with_zlib

def configure(self):
if self.options.shared:
Expand All @@ -80,7 +86,7 @@ def configure(self):
def requirements(self):
if self.options.with_ssl:
self.requires("openssl/1.1.1m")
if self.options.with_zlib and tools.Version(self.version) >= "1.15":
if self.options.get_safe("with_zlib"):
self.requires("zlib/1.2.11")

def validate(self):
Expand Down Expand Up @@ -118,8 +124,8 @@ def _configure_cmake(self):
self._cmake.definitions["CIVETWEB_ENABLE_WEBSOCKETS"] = self.options.with_websockets
self._cmake.definitions["CIVETWEB_SERVE_NO_FILES"] = not self.options.with_static_files

if tools.Version(self.version) >= "1.15":
self._cmake.definitions["CIVETWEB_ENABLE_ZLIB"] = self.options.with_zlib
if self.options.get_safe("with_zlib"):
self._cmake.definitions["CIVETWEB_ENABLE_ZLIB"] = True
jlouazel marked this conversation as resolved.
Show resolved Hide resolved

self._cmake.configure(build_dir=self._build_subfolder)
return self._cmake
Expand Down Expand Up @@ -158,8 +164,11 @@ def package_info(self):
self.cpp_info.components["_civetweb"].system_libs.append("ws2_32")
if self.options.shared:
self.cpp_info.components["_civetweb"].defines.append("CIVETWEB_DLL_IMPORTS")

if self.options.with_ssl:
self.cpp_info.components["_civetweb"].requires = ["openssl::openssl"]
self.cpp_info.components["_civetweb"].requires.append("openssl::openssl")
if self.options.get_safe("with_zlib"):
self.cpp_info.components["_civetweb"].requires.append("zlib::zlib")

if self.options.with_cxx:
self.cpp_info.components["civetweb-cpp"].names["cmake_find_package"] = "civetweb-cpp"
Expand Down