forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(conan-io#13038) xz_utils: conan v2 support
* conan v2 support * typo * refactor slightly * fix MinGW build DESTDIR manually injected due to conan-io/conan#12153 * workaround to update PlatformToolset in vcxproj files * fix install for compiler=msvc * remove WindowsTargetPlatformVersion in 5.2.4 * add ugly tricks for MSBuild * test custom CMake variables in conan generator variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html must be defined LIBLZMA_HAS_AUTO_DECODER, LIBLZMA_HAS_EASY_ENCODER & LIBLZMA_HAS_LZMA_PRESET are not modeled for the moment * typo * set win_bash in build_requirements
- Loading branch information
Showing
5 changed files
with
227 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
project(test_package LANGUAGES C) | ||
|
||
find_package(LibLZMA REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} LibLZMA::LibLZMA) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE LibLZMA::LibLZMA) | ||
|
||
# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html | ||
# are properly defined in conan generators | ||
set(_custom_vars | ||
LIBLZMA_FOUND | ||
LIBLZMA_INCLUDE_DIRS | ||
LIBLZMA_LIBRARIES | ||
LIBLZMA_VERSION_MAJOR | ||
LIBLZMA_VERSION_MINOR | ||
LIBLZMA_VERSION_PATCH | ||
LIBLZMA_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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def build_requirements(self): | ||
if self.settings.os == "Macos" and self.settings.arch == "armv8": | ||
# Workaround for CMake bug with error message: | ||
# Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being | ||
# set. This could be because you are using a Mac OS X version less than 10.5 | ||
# or because CMake's platform configuration is corrupt. | ||
# FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. | ||
self.build_requires("cmake/3.22.0") | ||
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 not tools.cross_building(self): | ||
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") |
Oops, something went wrong.