# FindXMLRPC

Finds the native XML-RPC library for C and C++:

    find_package(XMLRPC [...] [COMPONENTS <components>...] [...])

XML-RPC is a standard network protocol that enables remote procedure calls (RPC) between systems. It encodes requests and responses in XML and uses HTTP as the transport mechanism.

## Components

The XML-RPC C/C++ library consists of various features (modules) that provide specific functionality. The availability of these features depends on the installed XML-RPC library version and system configuration. Some features also have dependencies on others.

To list the available features on a system, the `xmlrpc-c-config` command-line utility can be used.

In CMake, these features can be specified as components with the `find_package()` command:

    find_package(XMLRPC [COMPONENTS <components>...])

Components may be:

`c++2`

  C++ wrapper API, replacing the legacy `c++` feature.

`c++`

  The legacy C++ wrapper API (superseded by `c++2`).

`client`

  XML-RPC client functions (also available as the legacy libwww-based feature named `libwww-client`).

`cgi-server`

  CGI-based server functions.

`abyss-server`

  Abyss-based server functions.

`pstream-server`

  The pstream-based server functions.

`server-util`

  Basic server functions (they are automatically included with `*-server` features).

`abyss`

  Abyss HTTP server (not needed with `abyss-server`).

`openssl`

  OpenSSL convenience functions.

If no components are specified, this module searches for XML-RPC library and its include directories without additional features.

## Result Variables

This module defines the following variables:

`XMLRPC_FOUND`

  Boolean indicating whether the XML-RPC library and all its requested components were found.

`XMLRPC_INCLUDE_DIRS`

  Include directories containing `xmlrpc.h` and other headers needed to use the XML-RPC library.

`XMLRPC_LIBRARIES`

  List of libraries needed for linking to XML-RPC library and its requested features.

## Examples

Finding XML-RPC library and its `client` feature, and conditionally creating an interface imported target that encapsulates its usage requirements for linking to a project target:

    find_package(XMLRPC REQUIRED COMPONENTS client)

    if(XMLRPC_FOUND AND NOT TARGET XMLRPC::XMLRPC)
      add_library(XMLRPC::XMLRPC INTERFACE IMPORTED)
      set_target_properties(
        XMLRPC::XMLRPC
        PROPERTIES
          INTERFACE_INCLUDE_DIRECTORIES "${XMLRPC_INCLUDE_DIRS}"
          INTERFACE_LINK_LIBRARIES "${XMLRPC_LIBRARIES}"
      )
    endif()

    target_link_libraries(example PRIVATE XMLRPC::XMLRPC)