text: from conans import ConanFile, CMake, tools
  
  required_conan_version = ">=1.36.0"
  
  
  class EnetConan(ConanFile):
      name = "enet"
      description = "ENet reliable UDP networking library"
      topics = ("enet", "udp", "networking")
      url = "https://github.com/conan-io/conan-center-index"
      homepage = "https://github.com/lsalzman/enet"
      license = "MIT"
  
      settings = "os", "arch", "compiler", "build_type"
      options = {
          "shared": [True, False],
          "fPIC": [True, False],
      }
      default_options = {
          "shared": False,
          "fPIC": True,
      }
  
      generators = "cmake"
      _cmake = None
  
      @property
      def _source_subfolder(self):
          return "source_subfolder"
  
      @property
      def _is_msvc(self):
          return str(self.settings.compiler) in ["Visual Studio", "msvc"]
  
      def export_sources(self):
          self.copy("CMakeLists.txt")
          for patch in self.conan_data.get("patches", {}).get(self.version, []):
              self.copy(patch["patch_file"])
  
      def config_options(self):
          if self.settings.os == "Windows":
              del self.options.fPIC
  
      def configure(self):
          if self.options.shared:
              del self.options.fPIC
          del self.settings.compiler.libcxx
          del self.settings.compiler.cppstd
  
      def source(self):
          tools.get(**self.conan_data["sources"][self.version],
                    destination=self._source_subfolder, strip_root=True)
  
      def _configure_cmake(self):
          if self._cmake:
              return self._cmake
          self._cmake = CMake(self)
          self._cmake.configure()
          return self._cmake
  
      def build(self):
          for patch in self.conan_data.get("patches", {}).get(self.version, []):
              tools.patch(**patch)
          cmake = self._configure_cmake()
          cmake.build()
  
      def package(self):
          self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
          cmake = self._configure_cmake()
          cmake.install()
  
      def package_info(self):
          self.cpp_info.set_property("pkg_config_name", "libenet")
          self.cpp_info.libs = ["enet"]
          if self.settings.os == "Windows":
              self.cpp_info.system_libs.extend(["ws2_32", "winmm"])
          if self._is_msvc and self.options.shared:
              self.cpp_info.defines.append("ENET_DLL")
  