Skip to content

Commit

Permalink
allow 3.4.0 and Visual Studio 16
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Jan 12, 2021
1 parent 1c3e29a commit 8b78e2f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 4 additions & 0 deletions recipes/libarchive/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ sources:
"3.4.3":
url: "https://github.com/libarchive/libarchive/releases/download/v3.4.3/libarchive-3.4.3.tar.gz"
sha256: "ee1e749213c108cb60d53147f18c31a73d6717d7e3d2481c157e1b34c881ea39"
patches:
"3.4.0":
- patch_file: "patches/msvc-no-we4061.patch"
base_path: "source_subfolder"
9 changes: 4 additions & 5 deletions recipes/libarchive/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LibarchiveConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://libarchive.org"
license = "BSD"
exports_sources = ["CMakeLists.txt"]
exports_sources = ["CMakeLists.txt", "patches/**"]
generators = "cmake", "cmake_find_package"
settings = "os", "arch", "compiler", "build_type"
options = {
Expand Down Expand Up @@ -95,10 +95,6 @@ def requirements(self):
# TODO: deps not covered yet: cng, nettle, libb2

def validate(self):
if self.version == "3.4.0":
# https://github.com/libarchive/libarchive/pull/1395
if self.settings.compiler == "Visual Studio" and self.settings.compiler.version == "16":
raise ConanInvalidConfiguration("Visual Studio 16 is not supported")
if self.options.with_expat and self.options.with_libxml2:
raise ConanInvalidConfiguration("libxml2 and expat options are exclusive. They cannot be used together as XML engine")

Expand Down Expand Up @@ -142,6 +138,9 @@ def _configure_cmake(self):
return self._cmake

def _patch_sources(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)

cmakelists_path = os.path.join(self._source_subfolder, "CMakeLists.txt")

# it can possibly override CMAKE_MODULE_PATH provided by generator
Expand Down
10 changes: 10 additions & 0 deletions recipes/libarchive/all/patches/msvc-no-we4061.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,7 +157,6 @@ IF (MSVC)
# This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug"
# Enable level 4 C4061: The enumerate has no associated handler in a switch
# statement.
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4061")
# Enable level 4 C4254: A larger bit field was assigned to a smaller bit
# field.
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4254")

0 comments on commit 8b78e2f

Please sign in to comment.