diff --git a/recipes/soci/all/conandata.yml b/recipes/soci/all/conandata.yml index fec95012281aa..b94ce73cc0bdf 100644 --- a/recipes/soci/all/conandata.yml +++ b/recipes/soci/all/conandata.yml @@ -2,6 +2,9 @@ sources: "4.0.3": url: "https://github.com/SOCI/soci/archive/v4.0.3.tar.gz" sha256: "4b1ff9c8545c5d802fbe06ee6cd2886630e5c03bf740e269bb625b45cf934928" + "4.1.2": + url: "https://github.com/SOCI/soci/archive/v4.1.2.tar.gz" + sha256: "c0974067e57242f21d9a85677c5f6cc7848fba3cbd5ec58d76c95570a5a7a15b" patches: "4.0.3": - patch_file: "patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch" diff --git a/recipes/soci/all/conanfile.py b/recipes/soci/all/conanfile.py index 2a461a5992208..3ca9a5bedd208 100644 --- a/recipes/soci/all/conanfile.py +++ b/recipes/soci/all/conanfile.py @@ -48,6 +48,10 @@ def export_sources(self): def layout(self): cmake_layout(self, src_folder="src") + def build_requirements(self): + if Version(self.version) >= "4.1.0": + self.tool_requires("cmake/[>=3.23 <4]") + def requirements(self): # New versions will not need transitive_headers=True if self.options.with_sqlite3: @@ -57,12 +61,15 @@ def requirements(self): if self.options.with_mysql: self.requires("libmysqlclient/8.1.0", transitive_headers=True) if self.options.with_postgresql: - self.requires("libpq/15.4", transitive_headers=True) + self.requires("libpq/[>=15.4 <17.0]", transitive_headers=True) if self.options.with_boost: self.requires("boost/1.83.0", transitive_headers=True) def validate(self): - check_min_cppstd(self, 11) + if Version(self.version) < "4.1.0": + check_min_cppstd(self, 11) + else: + check_min_cppstd(self, 14) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -70,23 +77,23 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - + backend_prefix = "WITH" if Version(self.version) < "4.1.0" else "SOCI" # MacOS @rpath tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" tc.cache_variables["SOCI_SHARED"] = self.options.shared tc.cache_variables["SOCI_STATIC"] = not self.options.shared tc.cache_variables["SOCI_TESTS"] = False - tc.cache_variables["SOCI_CXX11"] = True tc.cache_variables["SOCI_EMPTY"] = self.options.empty - tc.cache_variables["WITH_SQLITE3"] = self.options.with_sqlite3 - tc.cache_variables["WITH_DB2"] = False - tc.cache_variables["WITH_ODBC"] = self.options.with_odbc - tc.cache_variables["WITH_ORACLE"] = False - tc.cache_variables["WITH_FIREBIRD"] = False - tc.cache_variables["WITH_MYSQL"] = self.options.with_mysql - tc.cache_variables["WITH_POSTGRESQL"] = self.options.with_postgresql + tc.cache_variables["{}_SQLITE3".format(backend_prefix)] = self.options.with_sqlite3 + tc.cache_variables["{}_DB2".format(backend_prefix)] = False + tc.cache_variables["{}_ODBC".format(backend_prefix)] = self.options.with_odbc + tc.cache_variables["{}_ORACLE".format(backend_prefix)] = False + tc.cache_variables["{}_FIREBIRD".format(backend_prefix)] = False + tc.cache_variables["{}_MYSQL".format(backend_prefix)] = self.options.with_mysql + tc.cache_variables["{}_POSTGRESQL".format(backend_prefix)] = self.options.with_postgresql tc.cache_variables["WITH_BOOST"] = self.options.with_boost if Version(self.version) < "4.1.0": # pylint: disable=conan-condition-evals-to-constant + tc.cache_variables["SOCI_CXX11"] = True tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support tc.generate() @@ -114,9 +121,9 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "SOCI") target_suffix = "" if self.options.shared else "_static" - lib_prefix = "lib" if is_msvc(self) and not self.options.shared else "" version = Version(self.version) - lib_suffix = "_{}_{}".format(version.major, version.minor) if self.settings.os == "Windows" else "" + lib_prefix = "lib" if version < "4.1.0" and is_msvc(self) and not self.options.shared else "" + lib_suffix = "_{}_{}".format(version.major, version.minor) if (version < "4.1.0" or self.options.shared) and self.settings.os == "Windows" else "" # soci_core self.cpp_info.components["soci_core"].set_property("cmake_target_name", "SOCI::soci_core{}".format(target_suffix)) diff --git a/recipes/soci/all/test_package/CMakeLists.txt b/recipes/soci/all/test_package/CMakeLists.txt index 4f5a4c0df6833..891dd6c597a38 100644 --- a/recipes/soci/all/test_package/CMakeLists.txt +++ b/recipes/soci/all/test_package/CMakeLists.txt @@ -9,4 +9,3 @@ if(TARGET SOCI::soci_core_static) else() target_link_libraries(${PROJECT_NAME} SOCI::soci_core) endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/soci/all/test_package/conanfile.py b/recipes/soci/all/test_package/conanfile.py index d120a992c06a6..33fec23e8ad07 100644 --- a/recipes/soci/all/test_package/conanfile.py +++ b/recipes/soci/all/test_package/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout +from conan.tools.scm import Version import os @@ -8,6 +9,10 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + def build_requirements(self): + if Version(self.tested_reference_str.split('/')[1]) >= "4.1.0": + self.tool_requires("cmake/[>=3.23 <4]") + def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/soci/config.yml b/recipes/soci/config.yml index 404a7ddf18bdf..1bb976ce1607a 100644 --- a/recipes/soci/config.yml +++ b/recipes/soci/config.yml @@ -1,3 +1,5 @@ versions: "4.0.3": folder: all + "4.1.2": + folder: all