7
7
from conan .errors import ConanInvalidConfiguration
8
8
import os
9
9
10
- required_conan_version = ">=1.55.0 "
10
+ required_conan_version = ">=2.1 "
11
11
12
12
13
13
class SociConan (ConanFile ):
@@ -17,7 +17,7 @@ class SociConan(ConanFile):
17
17
description = "The C++ Database Access Library "
18
18
topics = ("mysql" , "odbc" , "postgresql" , "sqlite3" )
19
19
license = "BSL-1.0"
20
-
20
+ package_type = "library"
21
21
settings = "os" , "arch" , "compiler" , "build_type"
22
22
options = {
23
23
"shared" : [True , False ],
@@ -125,6 +125,8 @@ def generate(self):
125
125
tc .variables ["WITH_MYSQL" ] = self .options .with_mysql
126
126
tc .variables ["WITH_POSTGRESQL" ] = self .options .with_postgresql
127
127
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
128
130
tc .generate ()
129
131
130
132
deps = CMakeDeps (self )
@@ -159,7 +161,7 @@ def package_info(self):
159
161
self .cpp_info .components ["soci_core" ].set_property ("cmake_target_name" , "SOCI::soci_core{}" .format (target_suffix ))
160
162
self .cpp_info .components ["soci_core" ].libs = ["{}soci_core{}" .format (lib_prefix , lib_suffix )]
161
163
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 " )
163
165
164
166
# soci_empty
165
167
if self .options .empty :
@@ -194,24 +196,3 @@ def package_info(self):
194
196
self .cpp_info .components ["soci_postgresql" ].set_property ("cmake_target_name" , "SOCI::soci_postgresql{}" .format (target_suffix ))
195
197
self .cpp_info .components ["soci_postgresql" ].libs = ["{}soci_postgresql{}" .format (lib_prefix , lib_suffix )]
196
198
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 )
0 commit comments