from conans import ConanFile, tools
import os


class JsonForModernCppConan(ConanFile):
    name = "jsonformoderncpp"
    version = "3.1.1"
    description = "JSON for Modern C++ parser and generator from https://github.com/nlohmann/json"
    license = "MIT"
    url = "https://github.com/vthiery/conan-jsonformoderncpp"
    repo_url = "https://github.com/nlohmann/json"
    author = "Vincent Thiery (vjmthiery@gmail.com)"

    def source(self):
        tools.download("%s/blob/v%s/LICENSE.MIT" % (self.repo_url, self.version), "LICENSE.MIT")

        expected_hash = "fde771d4b9e4f222965c00758a2bdd627d04fb7b59e09b7f3d1965abdc848505"
        tools.get("%s/releases/download/v%s/include.zip" % (self.repo_url, self.version), sha256=expected_hash)

    def package(self):
        self.copy("*.hpp")
        self.copy("LICENSE.MIT")


@@ -22,16 +22,23 @@
 nanFile,
+ CMake,
  tools%0Ai
@@ -140,16 +140,70 @@
 %223.1.1%22%0A
+    settings = %22os%22, %22compiler%22, %22arch%22, %22build_type%22%0A
     desc
@@ -518,376 +518,456 @@
 ols.
-download(%22%25s/blob/v%25s/LICENSE.MIT%22 %25 (self.repo_url, self.version), %22LICENSE.MIT%22)%0A%0A        expected_hash = %22fde771d4b9e4f222965c00758a2bdd627d04fb7b59e09b7f3d1965abdc848505%22%0A        tools.get(%22%25s/releases/download/v%25s/include.zip%22 %25 (self.repo_url, self.version), sha256=expected_hash)%0A%0A    def package(self):%0A        self.copy(%22*.hpp%22)%0A        self.copy(%22LICENSE.MIT%22
+get(%22%25s/archive/v%25s.zip%22 %25 (self.repo_url, self.version))%0A%0A    def build(self):%0A        cmake = CMake(self)%0A        cmake.definitions%5B%22JSON_BuildTests%22%5D = False%0A        cmake.definitions%5B%22JSON_MultipleHeaders%22%5D = True%0A        cmake.configure(source_folder=%22json-%25s%22 %25 self.version)%0A        cmake.install()%0A%0A    def package(self):%0A        self.copy(%22LICENSE.MIT%22, src=%22json-%25s%22 %25 self.version)%0A%0A    def package_id(self):%0A        self.info.header_only(
 )%0A
-%0A

Package the library using cmake's install target (#17)