diff --git a/recipes/apr-util/all/CMakeLists.txt b/recipes/apr-util/all/CMakeLists.txt deleted file mode 100644 index 2a122ebfa3606..0000000000000 --- a/recipes/apr-util/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/apr-util/all/conandata.yml b/recipes/apr-util/all/conandata.yml index 54e26418aee59..a6e26f0be8aa7 100644 --- a/recipes/apr-util/all/conandata.yml +++ b/recipes/apr-util/all/conandata.yml @@ -1,14 +1,10 @@ sources: "1.6.1": - sha256: "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459" url: - "https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz" - "https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz" + sha256: "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459" patches: "1.6.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-build-only-shared-static.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-apu-config-prefix-env.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-disable-check-APR_LIBRARIES.patch" + - patch_file: "patches/0001-fix-cmake.patch" + - patch_file: "patches/0002-apu-config-prefix-env.patch" diff --git a/recipes/apr-util/all/conanfile.py b/recipes/apr-util/all/conanfile.py index f7c03746e3c19..86dd0a9fc160c 100644 --- a/recipes/apr-util/all/conanfile.py +++ b/recipes/apr-util/all/conanfile.py @@ -1,20 +1,30 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc import os - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class AprUtilConan(ConanFile): name = "apr-util" - description = "The Apache Portable Runtime (APR) provides a predictable and consistent interface to underlying platform-specific implementations" + description = ( + "The Apache Portable Runtime (APR) provides a predictable and " + "consistent interface to underlying platform-specific implementations" + ) license = "Apache-2.0" - topics = ("apr-util", "apache", "platform", "library") + topics = ("apache", "platform", "library") homepage = "https://apr.apache.org/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake", "cmake_find_package" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -45,8 +55,8 @@ class AprUtilConan(ConanFile): "with_ldap": False, } - _autotools = None - _cmake = None + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -54,153 +64,158 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + self.options["apr"].shared = self.options.shared - if not self.options.with_expat: - raise ConanInvalidConfiguration("expat cannot be disabled (at this time) (check back later)") - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): - self.requires("apr/1.7.0") + self.requires("apr/1.7.0", transitive_headers=True) if self.settings.os != "Windows": #cmake build doesn't allow injection of iconv yet - self.requires("libiconv/1.16") + # https://github.com/conan-io/conan-center-index/pull/16142#issuecomment-1494282164 + # transitive_libs needs to be set because some sys-frameworks on the old mac images for c3i + # are pulling it in - discovered in https://github.com/conan-io/conan-center-index/pull/16266 + self.requires("libiconv/1.17", transitive_libs=True) if self.options.with_openssl: - self.requires("openssl/1.1.1k") + self.requires("openssl/1.1.1t") + if self.options.with_mysql: + self.requires("libmysqlclient/8.0.31") + if self.options.with_sqlite3: + self.requires("sqlite3/3.41.1") + if self.options.with_expat: + self.requires("expat/2.5.0") + if self.options.with_postgresql: + self.requires("libpq/14.5") + + def validate(self): + if not self.options.with_expat: + raise ConanInvalidConfiguration("expat cannot be disabled (at this time) (check back later)") + if self.options.shared != self.dependencies["apr"].options.shared: + raise ConanInvalidConfiguration("apr-util must be built with same shared option as apr") if self.options.with_nss: - # self.requires("nss/x.y.z") raise ConanInvalidConfiguration("CCI has no nss recipe (yet)") if self.options.with_commoncrypto: - # self.requires("commoncrypto/x.y.z") raise ConanInvalidConfiguration("CCI has no commoncrypto recipe (yet)") if self.options.dbm == "gdbm": - # self.requires("gdbm/x.y.z") raise ConanInvalidConfiguration("CCI has no gdbm recipe (yet)") elif self.options.dbm == "ndbm": - # self.requires("ndbm/x.y.z") raise ConanInvalidConfiguration("CCI has no ndbm recipe (yet)") elif self.options.dbm == "db": - # self.requires("libdb/x.y.z") raise ConanInvalidConfiguration("CCI has no libdb recipe (yet)") if self.options.with_lber: - # self.requires("lber/x.y.z") raise ConanInvalidConfiguration("CCI has no lber recipe (yet)") if self.options.with_ldap: - # self.requires("ldap/x.y.z") raise ConanInvalidConfiguration("CCI has no ldap recipe (yet)") - if self.options.with_mysql: - self.requires("libmysqlclient/8.0.25") - if self.options.with_sqlite3: - self.requires("sqlite3/3.35.5") - if self.options.with_expat: - self.requires("expat/2.4.1") - if self.options.with_postgresql: - self.requires("libpq/13.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def validate(self): - if self.options.shared != self.options["apr"].shared: - raise ConanInvalidConfiguration("apr-util must be built with same shared option as apr") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["APR_INCLUDE_DIR"] = ";".join(self.deps_cpp_info["apr"].include_paths) - self._cmake.definitions["INSTALL_PDB"] = False - self._cmake.definitions["APU_HAVE_CRYPTO"] = self._with_crypto - self._cmake.definitions["APR_HAS_LDAP"] = self.options.with_ldap - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _with_crypto(self): return self.options.with_openssl or self.options.with_nss or self.options.with_commoncrypto - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - self._autotools.include_paths = [] - if self._with_crypto: - if self.settings.os == "Linux": - self._autotools.libs.append("dl") - conf_args = [ - "--with-apr={}".format(tools.unix_path(self.deps_cpp_info["apr"].rootpath)), - "--with-crypto" if self._with_crypto else "--without-crypto", - "--with-iconv={}".format(tools.unix_path(self.deps_cpp_info["libiconv"].rootpath)), - "--with-openssl={}".format(tools.unix_path(self.deps_cpp_info["openssl"].rootpath)) if self.options.with_openssl else "--without-openssl", - "--with-expat={}".format(tools.unix_path(self.deps_cpp_info["expat"].rootpath)) if self.options.with_expat else "--without-expat", - "--with-mysql={}".format(tools.unix_path(self.deps_cpp_info["libmysqlclient"].rootpath)) if self.options.with_mysql else "--without-mysql", - "--with-pgsql={}".format(tools.unix_path(self.deps_cpp_info["libpq"].rootpath)) if self.options.with_postgresql else "--without-pgsql", - "--with-sqlite3={}".format(tools.unix_path(self.deps_cpp_info["sqlite3"].rootpath)) if self.options.with_sqlite3 else "--without-sqlite3", - "--with-ldap={}".format(tools.unix_path(self.deps_cpp_info["ldap"].rootpath)) if self.options.with_ldap else "--without-ldap", - "--with-berkeley-db={}".format(tools.unix_path(self.deps_cpp_info["libdb"].rootpath)) if self.options.dbm == "db" else "--without-berkeley-db", - "--with-gdbm={}".format(tools.unix_path(self.deps_cpp_info["gdbm"].rootpath)) if self.options.dbm == "gdbm" else "--without-gdbm", - "--with-ndbm={}".format(tools.unix_path(self.deps_cpp_info["ndbm"].rootpath)) if self.options.dbm == "ndbm" else "--without-ndbm", - ] - if self.options.dbm: - conf_args.append("--with-dbm={}".format(self.options.dbm)) - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.variables["INSTALL_PDB"] = False + tc.variables["APU_HAVE_CRYPTO"] = self._with_crypto + tc.variables["APR_HAS_LDAP"] = self.options.with_ldap + tc.generate() + deps = CMakeDeps(self) + deps.generate() + else: + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + rootpath_no = lambda v, req: self.dependencies[req].package_folder if v else "no" + tc.configure_args.extend([ + f"--with-apr={rootpath_no(True, 'apr')}", + f"--with-crypto={yes_no(self._with_crypto)}", + f"--with-iconv={rootpath_no(True, 'libiconv')}", + f"--with-openssl={rootpath_no(self.options.with_openssl, 'openssl')}", + f"--with-expat={rootpath_no(self.options.with_expat, 'expat')}", + f"--with-mysql={rootpath_no(self.options.with_mysql, 'libmysqlclient')}", + f"--with-pgsql={rootpath_no(self.options.with_postgresql, 'libpq')}", + f"--with-sqlite3={rootpath_no(self.options.with_sqlite3, 'sqlite3')}", + f"--with-ldap={rootpath_no(self.options.with_ldap, 'ldap')}", + f"--with-berkeley-db={rootpath_no(self.options.dbm == 'db', 'libdb')}", + f"--with-gdbm={rootpath_no(self.options.dbm == 'gdbm', 'gdbm')}", + f"--with-ndbm={rootpath_no(self.options.dbm == 'ndbm', 'ndbm')}", + ]) + if self.options.dbm: + tc.configure_args.append(f"--with-dbm={self.options.dbm}") + if self._with_crypto and self.settings.os in ["Linux", "FreeBSD"]: + tc.extra_ldflags.append("-ldl") + env = tc.environment() + env.define_path("APR_ROOT", self.dependencies["apr"].package_folder) + env.define_path("_APR_BUILDDIR", os.path.join(self.dependencies["apr"].package_folder, "res", "build-1")) + tc.generate(env) + + deps = AutotoolsDeps(self) + deps.generate() def build(self): - self._patch_sources() + apply_conandata_patches(self) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib", "apr-util-1"), "*.la") - os.unlink(os.path.join(self.package_folder, "lib", "libaprutil-1.la")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "apr-util-1" - self.cpp_info.libs = ["libaprutil-1" if self.settings.os == "Windows" and self.options.shared else "aprutil-1"] + self.cpp_info.set_property("pkg_config_name", "apr-util-1") + if self.settings.os == "Windows": + self.cpp_info.libs = ["apr_dbd_odbc-1"] + if self._with_crypto: + self.cpp_info.libs.append("apr_crypto_openssl-1") + if self.options.with_ldap: + self.cpp_info.libs.append("apr_ldap-1") + prefix = "lib" if self.options.shared else "" + self.cpp_info.libs.append(f"{prefix}aprutil-1") + else: + self.cpp_info.libs = ["aprutil-1"] self.cpp_info.libdirs.append(os.path.join("lib", "apr-util-1")) if not self.options.shared: self.cpp_info.defines = ["APU_DECLARE_STATIC"] - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "pthread", "rt"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["crypt", "dl", "pthread", "rt"] elif self.settings.os == "Windows": - self.cpp_info.system_libs = ["mswsock", "rpcrt4", "ws2_32"] + self.cpp_info.system_libs = ["mswsock", "odbc32", "rpcrt4", "ws2_32"] - binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var : {}".format(binpath)) - self.env_info.PATH.append(binpath) + self.runenv_info.define_path("APR_UTIL_ROOT", self.package_folder) - apr_util_root = tools.unix_path(self.package_folder) - self.output.info("Settings APR_UTIL_ROOT environment var: {}".format(apr_util_root)) - self.env_info.APR_UTIL_ROOT = apr_util_root + deps = [dep for dep in reversed(self.dependencies.host.topological_sort.values())] + libdirs = [p for dep in deps for p in dep.cpp_info.aggregated_components().includedirs] + aprutil_ldflags = " ".join([f"-L{p}" for p in libdirs]) + self.runenv_info.define("APRUTIL_LDFLAGS", aprutil_ldflags) - if self.settings.compiler != "Visual Studio": - self.env_info.APRUTIL_LDFLAGS = " ".join(tools.unix_path("-L{}".format(l)) for l in self.deps_cpp_info.lib_paths) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.APR_UTIL_ROOT = self.package_folder + if not is_msvc(self): + self.env_info.APRUTIL_LDFLAGS = aprutil_ldflags diff --git a/recipes/apr-util/all/patches/0001-cmake-build-only-shared-static.patch b/recipes/apr-util/all/patches/0001-fix-cmake.patch similarity index 59% rename from recipes/apr-util/all/patches/0001-cmake-build-only-shared-static.patch rename to recipes/apr-util/all/patches/0001-fix-cmake.patch index f1ea7fe873eeb..0083d495d06dc 100644 --- a/recipes/apr-util/all/patches/0001-cmake-build-only-shared-static.patch +++ b/recipes/apr-util/all/patches/0001-fix-cmake.patch @@ -1,10 +1,50 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -227,24 +227,24 @@ SET(install_bin_pdb) - SET(dbd_drivers) +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,13 +15,13 @@ + # + # Read README.cmake before using this. + ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(APR-Util C) + +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + + FIND_PACKAGE(OpenSSL) + +-FIND_PACKAGE(expat) ++FIND_PACKAGE(EXPAT MODULE) + + OPTION(APU_HAVE_CRYPTO "Crypto support" OFF) + OPTION(APU_HAVE_ODBC "Build ODBC DBD driver" ON) +@@ -29,17 +29,14 @@ OPTION(APR_HAS_LDAP "LDAP support" ON) + OPTION(INSTALL_PDB "Install .pdb files (if generated)" ON) + OPTION(APR_BUILD_TESTAPR "Build the test suite" OFF) + OPTION(TEST_STATIC_LIBS "Test programs use APR static libraries instead of shared libraries?" OFF) +-SET(APR_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with APR include files") +-SET(APR_LIBRARIES "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib" CACHE STRING "APR library to link with") ++find_package(apr REQUIRED CONFIG) ++if(NOT DEFINED APR_INCLUDE_DIR) ++ set(APR_INCLUDE_DIR apr_INCLUDE_DIRS) ++endif() ++if(NOT DEFINED APR_LIBRARIES) ++ set(APR_LIBRARIES apr::apr) ++endif() + +-IF(NOT EXISTS "${APR_INCLUDE_DIR}/apr.h") +- MESSAGE(FATAL_ERROR "APR include directory ${APR_INCLUDE_DIR} is not correct.") +-ENDIF() +-FOREACH(onelib ${APR_LIBRARIES}) +- IF(NOT EXISTS ${onelib}) +- MESSAGE(FATAL_ERROR "APR library ${onelib} was not found.") +- ENDIF() +-ENDFOREACH() + + IF(APU_HAVE_CRYPTO) + IF(NOT OPENSSL_FOUND) +@@ -228,23 +225,26 @@ SET(dbd_drivers) # Note: The WINNT definition on some targets is used only by libaprutil.rc. -- + +if(BUILD_SHARED_LIBS) # libaprutil-1 is shared, aprutil-1 is static ADD_LIBRARY(libaprutil-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libaprutil.rc) @@ -12,14 +52,14 @@ SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libaprutil-1.pdb) TARGET_LINK_LIBRARIES(libaprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES}) SET_TARGET_PROPERTIES(libaprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_EXPORT;APR_DECLARE_EXPORT;XML_STATIC;WINNT") -- +else() + ADD_LIBRARY(aprutil-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED}) SET(install_targets ${install_targets} aprutil-1) TARGET_LINK_LIBRARIES(aprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES}) SET_TARGET_PROPERTIES(aprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_STATIC;APR_DECLARE_STATIC;APU_DSO_MODULE_BUILD;XML_STATIC") -- +endif() + IF(APU_HAVE_CRYPTO) IF(NOT OPENSSL_FOUND) MESSAGE(FATAL_ERROR "Only OpenSSL-based crypto is currently implemented in the cmake build") diff --git a/recipes/apr-util/all/patches/0003-disable-check-APR_LIBRARIES.patch b/recipes/apr-util/all/patches/0003-disable-check-APR_LIBRARIES.patch deleted file mode 100644 index 384b64b2544a7..0000000000000 --- a/recipes/apr-util/all/patches/0003-disable-check-APR_LIBRARIES.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -35,11 +35,11 @@ - IF(NOT EXISTS "${APR_INCLUDE_DIR}/apr.h") - MESSAGE(FATAL_ERROR "APR include directory ${APR_INCLUDE_DIR} is not correct.") - ENDIF() --FOREACH(onelib ${APR_LIBRARIES}) -- IF(NOT EXISTS ${onelib}) -- MESSAGE(FATAL_ERROR "APR library ${onelib} was not found.") -- ENDIF() --ENDFOREACH() -+SET(APR_LIBRARIES "${CONAN_LIBS_APR};mswsock;rpcrt4;ws2_32") #FOREACH(onelib ${APR_LIBRARIES}) -+# IF(NOT EXISTS ${onelib}) -+# MESSAGE(FATAL_ERROR "APR library ${onelib} was not found.") -+# ENDIF() -+#ENDFOREACH() - - IF(APU_HAVE_CRYPTO) - IF(NOT OPENSSL_FOUND) diff --git a/recipes/apr-util/all/test_package/CMakeLists.txt b/recipes/apr-util/all/test_package/CMakeLists.txt index f8b971e2db377..c273ab3463a77 100644 --- a/recipes/apr-util/all/test_package/CMakeLists.txt +++ b/recipes/apr-util/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(apr-util REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE apr-util::apr-util) diff --git a/recipes/apr-util/all/test_package/conanfile.py b/recipes/apr-util/all/test_package/conanfile.py index 9952431a15adf..0a6bc68712d90 100644 --- a/recipes/apr-util/all/test_package/conanfile.py +++ b/recipes/apr-util/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,9 +21,6 @@ def build(self): cmake.build() def test(self): - if self.settings.compiler != "Visual Studio": - self.run("apu-1-config --ldflags", win_bash=tools.os_info.is_windows) - - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/apr-util/all/test_v1_package/CMakeLists.txt b/recipes/apr-util/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/apr-util/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/apr-util/all/test_v1_package/conanfile.py b/recipes/apr-util/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/apr-util/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True)