from conans import ConanFile, CMake

class PEGTLConan(ConanFile):
    name = "pegtl"
    description = "C++ header-only parser combinator library for creating PEG parsers"
    homepage = "https://github.com/taocpp/PEGTL"
    url = homepage
    license = "MIT"
    author = "taocpp@icemx.net"
    exports = "LICENSE"
    exports_sources = "include/*", "CMakeLists.txt"
    generators = "cmake"
    no_copy_source = True

    def build(self):
        pass

    def package(self):
        cmake = CMake(self)
        cmake.definitions["PEGTL_BUILD_TESTS"] = "OFF"
        cmake.definitions["PEGTL_BUILD_EXAMPLES"] = "OFF"
        cmake.definitions["PEGTL_INSTALL_DOC_DIR"] = "licenses"
        cmake.configure()
        cmake.install()

    def package_id(self):
        self.info.header_only()

from conans import ConanFile, CMake

class PEGTLConan(ConanFile):
    name = "pegtl"
    description = "C++ header-only parser combinator library for creating PEG parsers"
    homepage = "https://github.com/taocpp/PEGTL"
    topics = ("conan", "taocpp", "pegtl", "peg", "grammar", "parsing")
    url = homepage
    license = "MIT"
    author = "taocpp@icemx.net"
    exports = "LICENSE"
    exports_sources = "include/*", "CMakeLists.txt"
    settings = "compiler"
    generators = "cmake"
    no_copy_source = True

    def build(self):
        pass

    def package(self):
        cmake = CMake(self)
        cmake.definitions["PEGTL_BUILD_TESTS"] = "OFF"
        cmake.definitions["PEGTL_BUILD_EXAMPLES"] = "OFF"
        cmake.definitions["PEGTL_INSTALL_DOC_DIR"] = "licenses"
        cmake.configure()
        cmake.install()

    def package_id(self):
        self.info.header_only()

Fix missing generator on Windows
Fix missing generator on Windows

- Since compiler is not listed on settings, CMake is not
  able to detect a valid generator, using MingGW by default
- Add topics to be used as tags for searching

Signed-off-by: Uilian Ries <d4bad57018205bdda203549c36d3feb0bfe416a7@gmail.com>

  from conans import ConanFile, CMake
  
  class PEGTLConan(ConanFile):
      name = "pegtl"
      description = "C++ header-only parser combinator library for creating PEG parsers"
      homepage = "https://github.com/taocpp/PEGTL"
+     topics = ("conan", "taocpp", "pegtl", "peg", "grammar", "parsing")
      url = homepage
      license = "MIT"
      author = "taocpp@icemx.net"
      exports = "LICENSE"
      exports_sources = "include/*", "CMakeLists.txt"
+     settings = "compiler"
      generators = "cmake"
      no_copy_source = True
  
      def build(self):
          pass
  
      def package(self):
          cmake = CMake(self)
          cmake.definitions["PEGTL_BUILD_TESTS"] = "OFF"
          cmake.definitions["PEGTL_BUILD_EXAMPLES"] = "OFF"
          cmake.definitions["PEGTL_INSTALL_DOC_DIR"] = "licenses"
          cmake.configure()
          cmake.install()
  
      def package_id(self):
          self.info.header_only()
  
Fix missing generator on Windows
## Code Before:
from conans import ConanFile, CMake

class PEGTLConan(ConanFile):
    name = "pegtl"
    description = "C++ header-only parser combinator library for creating PEG parsers"
    homepage = "https://github.com/taocpp/PEGTL"
    url = homepage
    license = "MIT"
    author = "taocpp@icemx.net"
    exports = "LICENSE"
    exports_sources = "include/*", "CMakeLists.txt"
    generators = "cmake"
    no_copy_source = True

    def build(self):
        pass

    def package(self):
        cmake = CMake(self)
        cmake.definitions["PEGTL_BUILD_TESTS"] = "OFF"
        cmake.definitions["PEGTL_BUILD_EXAMPLES"] = "OFF"
        cmake.definitions["PEGTL_INSTALL_DOC_DIR"] = "licenses"
        cmake.configure()
        cmake.install()

    def package_id(self):
        self.info.header_only()

## Instruction:
Fix missing generator on Windows
## Code After:
from conans import ConanFile, CMake

class PEGTLConan(ConanFile):
    name = "pegtl"
    description = "C++ header-only parser combinator library for creating PEG parsers"
    homepage = "https://github.com/taocpp/PEGTL"
    topics = ("conan", "taocpp", "pegtl", "peg", "grammar", "parsing")
    url = homepage
    license = "MIT"
    author = "taocpp@icemx.net"
    exports = "LICENSE"
    exports_sources = "include/*", "CMakeLists.txt"
    settings = "compiler"
    generators = "cmake"
    no_copy_source = True

    def build(self):
        pass

    def package(self):
        cmake = CMake(self)
        cmake.definitions["PEGTL_BUILD_TESTS"] = "OFF"
        cmake.definitions["PEGTL_BUILD_EXAMPLES"] = "OFF"
        cmake.definitions["PEGTL_INSTALL_DOC_DIR"] = "licenses"
        cmake.configure()
        cmake.install()

    def package_id(self):
        self.info.header_only()
