diff --git a/recipes/sole/all/conanfile.py b/recipes/sole/all/conanfile.py index e15d1c06c6dc1..ac242d0a91892 100644 --- a/recipes/sole/all/conanfile.py +++ b/recipes/sole/all/conanfile.py @@ -14,6 +14,7 @@ class SoleConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/r-lyeh-archived/sole" topics = ("uuid", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" def export_sources(self): @@ -30,19 +31,14 @@ def validate(self): check_min_cppstd(self, 11) def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): apply_conandata_patches(self) def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - copy( - self, - pattern="*.hpp", - dst=os.path.join(self.package_folder, "include"), - src=self.source_folder, - ) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", self.source_folder, os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.bindirs = [] diff --git a/recipes/sole/all/test_package/CMakeLists.txt b/recipes/sole/all/test_package/CMakeLists.txt index 829b5ca81b9ce..a08164097e4da 100644 --- a/recipes/sole/all/test_package/CMakeLists.txt +++ b/recipes/sole/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(sole REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE sole::sole) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sole/all/test_package/conanfile.py b/recipes/sole/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/sole/all/test_package/conanfile.py +++ b/recipes/sole/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +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", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - 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.bindir, "test_package") + self.run(bin_path, env="conanrun")