From 7ce174cb51ae8870aa379e4ffae3c6d407156d02 Mon Sep 17 00:00:00 2001 From: Jihadist Date: Thu, 16 Feb 2023 20:25:13 +0300 Subject: [PATCH] fix test_packages --- recipes/krb5/all/test_package/CMakeLists.txt | 8 ++------ recipes/krb5/all/test_v1_package/CMakeLists.txt | 8 ++++++++ recipes/krb5/all/test_v1_package/conanfile.py | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 recipes/krb5/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/krb5/all/test_v1_package/conanfile.py diff --git a/recipes/krb5/all/test_package/CMakeLists.txt b/recipes/krb5/all/test_package/CMakeLists.txt index d79cc491a4258f..8bf1b7258ab16d 100644 --- a/recipes/krb5/all/test_package/CMakeLists.txt +++ b/recipes/krb5/all/test_package/CMakeLists.txt @@ -1,11 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -include(FindPkgConfig) -pkg_check_modules(Krb5 REQUIRED krb5 IMPORTED_TARGET) +find_package(krb5 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::Krb5) +target_link_libraries(${PROJECT_NAME} PRIVATE krb5::krb5) diff --git a/recipes/krb5/all/test_v1_package/CMakeLists.txt b/recipes/krb5/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..f113bcd8a8b0e1 --- /dev/null +++ b/recipes/krb5/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +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/krb5/all/test_v1_package/conanfile.py b/recipes/krb5/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c10c6b4228f2ae --- /dev/null +++ b/recipes/krb5/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) \ No newline at end of file