[DO-981] qt package (!15)

Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/15
This commit is contained in:
Aleksandr Vodyanov
2025-02-13 12:25:48 +03:00
parent 60445ac09e
commit 3759e1163f
228 changed files with 16106 additions and 12 deletions

View File

@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.12)
project(test_package LANGUAGES C)
find_package(LibXml2 REQUIRED MODULE)
add_executable(${PROJECT_NAME} ../test_package/test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE LibXml2::LibXml2)
# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibXml2.html
# are properly defined in conan generators
set(_custom_vars
LibXml2_FOUND # since CMake 3.14
LIBXML2_FOUND # until CMake 3.14
LIBXML2_INCLUDE_DIR
LIBXML2_INCLUDE_DIRS
LIBXML2_LIBRARIES
LIBXML2_DEFINITIONS
LIBXML2_VERSION_STRING
)
foreach(_custom_var ${_custom_vars})
if(DEFINED ${_custom_var})
message(STATUS "${_custom_var}: ${${_custom_var}}")
else()
message(FATAL_ERROR "${_custom_var} not defined")
endif()
endforeach()

View File

@@ -0,0 +1,27 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "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)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "books.xml")
self.run(f"{bin_path} {xml_path}", env="conanrun")