Skip to content

Add CMake 4 support for civetweb #27622

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 5 additions & 10 deletions recipes/civetweb/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from conan.tools.scm import Version
import os

required_conan_version = ">=1.53.0"
required_conan_version = ">=2"


class CivetwebConan(ConanFile):
Expand Down Expand Up @@ -99,6 +99,7 @@ def validate(self):

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)

def generate(self):
tc = CMakeToolchain(self)
Expand Down Expand Up @@ -132,13 +133,15 @@ def generate(self):
if self._has_zlib_option:
tc.variables["CIVETWEB_ENABLE_ZLIB"] = self.options.with_zlib

if Version(self.version) <= "1.16":
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4

tc.generate()

cd = CMakeDeps(self)
cd.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down Expand Up @@ -187,11 +190,3 @@ def package_info(self):
elif self.settings.os == "Windows":
if self.options.shared:
self.cpp_info.components["civetweb-cpp"].defines.append("CIVETWEB_CXX_DLL_IMPORTS")

# TODO: to remove once conan v1 support dropped
self.cpp_info.components["_civetweb"].names["cmake_find_package"] = "civetweb"
self.cpp_info.components["_civetweb"].names["cmake_find_package_multi"] = "civetweb"
if self.options.with_cxx:
self.cpp_info.components["civetweb-cpp"].names["cmake_find_package"] = "civetweb-cpp"
self.cpp_info.components["civetweb-cpp"].names["cmake_find_package_multi"] = "civetweb-cpp"
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))