@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

if(@UPNP_BUILD_SHARED@)
	list(APPEND _upnp_available_components IXMLShared Shared)
endif()

if(@UPNP_BUILD_STATIC@)
	list(APPEND _upnp_available_components IXMLStatic Static)
endif()

if(UPNP_FIND_COMPONENTS)
	 set(_valid_components
		IXMLShared
		IXMLStatic
		Shared
		Static)

	foreach(comp IN LISTS UPNP_FIND_COMPONENTS)
		if(NOT comp IN_LIST _valid_components)
			set(UPNP_FOUND FALSE)
			set(UPNP_NOT_FOUND_MESSAGE
				"Unknown component: ${comp}")
			return()
		endif()
	endforeach()

	if(Shared IN_LIST UPNP_FIND_COMPONENTS)
		list(APPEND pt4w_comps Shared)
	endif()

	if(Static IN_LIST UPNP_FIND_COMPONENTS)
		list(APPEND pt4w_comps Static)
	endif()

	if(MSVC)
		find_dependency (PTHREADS4W
			COMPONENTS ${pt4w_comps})
	endif()
else()
	if(MSVC)
		find_dependency (PTHREADS4W)
	endif()
endif()

if(NOT MSVC)
	find_dependency (Threads)
endif()

if(@UPNP_ENABLE_OPEN_SSL@)
	find_dependency(OpenSSL)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/PUPNP.cmake)

if(NOT UPNP_FIND_COMPONENTS)
	set(UPNP_FOUND TRUE)
else()
	foreach(comp IN LISTS UPNP_FIND_COMPONENTS)
		list(FIND _upnp_available_components "${comp}" _idx)

		if(_idx EQUAL -1)
			set(UPNP_FOUND FALSE)
			set(UPNP_NOT_FOUND_MESSAGE
			"Component ${comp} is not available in this build")
		endif()
	endforeach()
endif()

set(IXML_HAVE_SCRIPTSUPPORT @IXML_HAVE_SCRIPTSUPPORT@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_ADAPTER_UUID_NAME @UPNP_ADAPTER_UUID_NAME@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS @UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_ENABLE_IPV6 @UPNP_ENABLE_IPV6@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_ENABLE_OPEN_SSL @UPNP_ENABLE_OPEN_SSL@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_ENABLE_POST_WRITE @UPNP_ENABLE_POST_WRITE@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_ENABLE_UNSPECIFIED_SERVER @UPNP_ENABLE_UNSPECIFIED_SERVER@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_CLIENT @UPNP_HAVE_CLIENT@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_DEBUG @UPNP_HAVE_DEBUG@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_DEVICE @UPNP_HAVE_DEVICE@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_GENA @UPNP_HAVE_GENA@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_OPTSSDP @UPNP_HAVE_OPTSSDP@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_SOAP @UPNP_HAVE_SOAP@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_SSDP @UPNP_HAVE_SSDP@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_TOOLS @UPNP_HAVE_TOOLS@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_HAVE_WEBSERVER @UPNP_HAVE_WEBSERVER@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_LARGEFILE_SENSITIVE @UPNP_LARGEFILE_SENSITIVE@ CACHE INTERNAL "see.upnpconfig.h")
set(UPNP_MINISERVER_REUSEADDR @UPNP_MINISERVER_REUSEADDR@ CACHE INTERNAL "see.upnpconfig.h")
