Skip to content

Commit 264d0cd

Browse files
soci: CMake 4 support (conan-io#27105)
* soci: CMake 4 support * soci needs only the header only parts from boost --------- Co-authored-by: Koronis Neilos <[email protected]>
1 parent 69a8657 commit 264d0cd

File tree

5 files changed

+7
-51
lines changed

5 files changed

+7
-51
lines changed

recipes/soci/all/conanfile.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from conan.errors import ConanInvalidConfiguration
88
import os
99

10-
required_conan_version = ">=1.55.0"
10+
required_conan_version = ">=2.1"
1111

1212

1313
class SociConan(ConanFile):
@@ -17,7 +17,7 @@ class SociConan(ConanFile):
1717
description = "The C++ Database Access Library "
1818
topics = ("mysql", "odbc", "postgresql", "sqlite3")
1919
license = "BSL-1.0"
20-
20+
package_type = "library"
2121
settings = "os", "arch", "compiler", "build_type"
2222
options = {
2323
"shared": [True, False],
@@ -125,6 +125,8 @@ def generate(self):
125125
tc.variables["WITH_MYSQL"] = self.options.with_mysql
126126
tc.variables["WITH_POSTGRESQL"] = self.options.with_postgresql
127127
tc.variables["WITH_BOOST"] = self.options.with_boost
128+
if Version(self.version) < "4.1.0": # pylint: disable=conan-condition-evals-to-constant
129+
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
128130
tc.generate()
129131

130132
deps = CMakeDeps(self)
@@ -159,7 +161,7 @@ def package_info(self):
159161
self.cpp_info.components["soci_core"].set_property("cmake_target_name", "SOCI::soci_core{}".format(target_suffix))
160162
self.cpp_info.components["soci_core"].libs = ["{}soci_core{}".format(lib_prefix, lib_suffix)]
161163
if self.options.with_boost:
162-
self.cpp_info.components["soci_core"].requires.append("boost::boost")
164+
self.cpp_info.components["soci_core"].requires.append("boost::headers")
163165

164166
# soci_empty
165167
if self.options.empty:
@@ -194,24 +196,3 @@ def package_info(self):
194196
self.cpp_info.components["soci_postgresql"].set_property("cmake_target_name", "SOCI::soci_postgresql{}".format(target_suffix))
195197
self.cpp_info.components["soci_postgresql"].libs = ["{}soci_postgresql{}".format(lib_prefix, lib_suffix)]
196198
self.cpp_info.components["soci_postgresql"].requires = ["soci_core", "libpq::libpq"]
197-
198-
# TODO: to remove in conan v2 once cmake_find_package* generators removed
199-
self.cpp_info.names["cmake_find_package"] = "SOCI"
200-
self.cpp_info.names["cmake_find_package_multi"] = "SOCI"
201-
self.cpp_info.components["soci_core"].names["cmake_find_package"] = "soci_core{}".format(target_suffix)
202-
self.cpp_info.components["soci_core"].names["cmake_find_package_multi"] = "soci_core{}".format(target_suffix)
203-
if self.options.empty:
204-
self.cpp_info.components["soci_empty"].names["cmake_find_package"] = "soci_empty{}".format(target_suffix)
205-
self.cpp_info.components["soci_empty"].names["cmake_find_package_multi"] = "soci_empty{}".format(target_suffix)
206-
if self.options.with_sqlite3:
207-
self.cpp_info.components["soci_sqlite3"].names["cmake_find_package"] = "soci_sqlite3{}".format(target_suffix)
208-
self.cpp_info.components["soci_sqlite3"].names["cmake_find_package_multi"] = "soci_sqlite3{}".format(target_suffix)
209-
if self.options.with_odbc:
210-
self.cpp_info.components["soci_odbc"].names["cmake_find_package"] = "soci_odbc{}".format(target_suffix)
211-
self.cpp_info.components["soci_odbc"].names["cmake_find_package_multi"] = "soci_odbc{}".format(target_suffix)
212-
if self.options.with_mysql:
213-
self.cpp_info.components["soci_mysql"].names["cmake_find_package"] = "soci_mysql{}".format(target_suffix)
214-
self.cpp_info.components["soci_mysql"].names["cmake_find_package_multi"] = "soci_mysql{}".format(target_suffix)
215-
if self.options.with_postgresql:
216-
self.cpp_info.components["soci_postgresql"].names["cmake_find_package"] = "soci_postgresql{}".format(target_suffix)
217-
self.cpp_info.components["soci_postgresql"].names["cmake_find_package_multi"] = "soci_postgresql{}".format(target_suffix)

recipes/soci/all/test_package/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.1)
1+
cmake_minimum_required(VERSION 3.15)
22
project(test_package CXX)
33

44
find_package(SOCI REQUIRED CONFIG)

recipes/soci/all/test_package/conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class TestPackageConan(ConanFile):
8-
settings = "os", "arch", "compiler", "build_type",
8+
settings = "os", "arch", "compiler", "build_type"
99
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
1010

1111
def requirements(self):

recipes/soci/all/test_v1_package/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

recipes/soci/all/test_v1_package/conanfile.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)