From 745fb0b5f6f6e7eac02419c6042fce18d13872b2 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 1 Jan 2023 13:27:25 +0100 Subject: [PATCH] avoid code duplication in test package --- recipes/libmicrohttpd/all/test_package/conanfile.py | 8 ++------ .../libmicrohttpd/all/test_v1_package/CMakeLists.txt | 10 ++++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/recipes/libmicrohttpd/all/test_package/conanfile.py b/recipes/libmicrohttpd/all/test_package/conanfile.py index f72d1f660e19f..98ab55852ad56 100644 --- a/recipes/libmicrohttpd/all/test_package/conanfile.py +++ b/recipes/libmicrohttpd/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,10 +15,6 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) - def generate(self): - tc = CMakeToolchain(self) - tc.generate() - def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt index 0b95e58322269..0d20897301b68 100644 --- a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt +++ b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libmicrohttpd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libmicrohttpd::libmicrohttpd) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package)