summaryrefslogtreecommitdiff
path: root/Modules/FindXMLRPC.cmake
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2017-10-11 15:16:57 +0900
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-10-11 15:16:57 +0900
commit915c76ded744c0f5f151402b9fa69f3fd8452573 (patch)
treeca6a387466543248890f346847acaa8343989b22 /Modules/FindXMLRPC.cmake
parent317dbdb79761ef65e45c7358cfc7571c6afa54ad (diff)
downloadcmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.gz
cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.bz2
cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.zip
Imported Upstream version 3.9.4upstream/3.9.4
Diffstat (limited to 'Modules/FindXMLRPC.cmake')
-rw-r--r--Modules/FindXMLRPC.cmake95
1 files changed, 46 insertions, 49 deletions
diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index c80249b56..f0b258397 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -1,42 +1,48 @@
-# - Find xmlrpc
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#.rst:
+# FindXMLRPC
+# ----------
+#
+# Find xmlrpc
+#
# Find the native XMLRPC headers and libraries.
-# XMLRPC_INCLUDE_DIRS - where to find xmlrpc.h, etc.
-# XMLRPC_LIBRARIES - List of libraries when using xmlrpc.
-# XMLRPC_FOUND - True if xmlrpc found.
+#
+# ::
+#
+# XMLRPC_INCLUDE_DIRS - where to find xmlrpc.h, etc.
+# XMLRPC_LIBRARIES - List of libraries when using xmlrpc.
+# XMLRPC_FOUND - True if xmlrpc found.
+#
# XMLRPC modules may be specified as components for this find module.
# Modules may be listed by running "xmlrpc-c-config". Modules include:
-# c++ C++ wrapper code
-# libwww-client libwww-based client
-# cgi-server CGI-based server
-# abyss-server ABYSS-based server
+#
+# ::
+#
+# c++ C++ wrapper code
+# libwww-client libwww-based client
+# cgi-server CGI-based server
+# abyss-server ABYSS-based server
+#
# Typical usage:
-# find_package(XMLRPC REQUIRED libwww-client)
-
-#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
+# ::
#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
+# find_package(XMLRPC REQUIRED libwww-client)
# First find the config script from which to obtain other values.
find_program(XMLRPC_C_CONFIG NAMES xmlrpc-c-config)
# Check whether we found anything.
if(XMLRPC_C_CONFIG)
- set(XMLRPC_FOUND 1)
+ set(XMLRPC_C_FOUND 1)
else()
- set(XMLRPC_FOUND 0)
+ set(XMLRPC_C_FOUND 0)
endif()
# Lookup the include directories needed for the components requested.
-if(XMLRPC_FOUND)
+if(XMLRPC_C_FOUND)
# Use the newer EXECUTE_PROCESS command if it is available.
if(COMMAND EXECUTE_PROCESS)
execute_process(
@@ -61,20 +67,19 @@ if(XMLRPC_FOUND)
# Look for -I options.
set(XMLRPC_INCLUDE_DIRS)
foreach(flag ${XMLRPC_C_CONFIG_CFLAGS})
- if("${flag}" MATCHES "^-I")
- string(REGEX REPLACE "^-I" "" DIR "${flag}")
- file(TO_CMAKE_PATH "${DIR}" DIR)
- set(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}")
+ if("${flag}" MATCHES "^-I(.+)")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
+ list(APPEND XMLRPC_INCLUDE_DIRS "${DIR}")
endif()
endforeach()
else()
message("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]")
- set(XMLRPC_FOUND 0)
+ set(XMLRPC_C_FOUND 0)
endif()
endif()
# Lookup the libraries needed for the components requested.
-if(XMLRPC_FOUND)
+if(XMLRPC_C_FOUND)
# Use the newer EXECUTE_PROCESS command if it is available.
if(COMMAND EXECUTE_PROCESS)
execute_process(
@@ -99,13 +104,11 @@ if(XMLRPC_FOUND)
set(XMLRPC_LIBRARY_DIRS)
set(XMLRPC_LIBRARY_NAMES)
foreach(flag ${XMLRPC_C_CONFIG_LIBS})
- if("${flag}" MATCHES "^-L")
- string(REGEX REPLACE "^-L" "" DIR "${flag}")
- file(TO_CMAKE_PATH "${DIR}" DIR)
- set(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}")
- elseif("${flag}" MATCHES "^-l")
- string(REGEX REPLACE "^-l" "" NAME "${flag}")
- set(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}")
+ if("${flag}" MATCHES "^-L(.+)")
+ file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR)
+ list(APPEND XMLRPC_LIBRARY_DIRS "${DIR}")
+ elseif("${flag}" MATCHES "^-l(.+)")
+ list(APPEND XMLRPC_LIBRARY_NAMES "${CMAKE_MATCH_1}")
endif()
endforeach()
@@ -120,7 +123,7 @@ if(XMLRPC_FOUND)
# If any library is not found then the whole package is not found.
if(NOT XMLRPC_${name}_LIBRARY)
- set(XMLRPC_FOUND 0)
+ set(XMLRPC_C_FOUND 0)
endif()
# Build an ordered list of all the libraries needed.
@@ -128,19 +131,13 @@ if(XMLRPC_FOUND)
endforeach()
else()
message("Error running ${XMLRPC_C_CONFIG}: [${XMLRPC_C_CONFIG_RESULT}]")
- set(XMLRPC_FOUND 0)
+ set(XMLRPC_C_FOUND 0)
endif()
endif()
# Report the results.
-if(NOT XMLRPC_FOUND)
- set(XMLRPC_DIR_MESSAGE
- "XMLRPC was not found. Make sure the entries XMLRPC_* are set.")
- if(NOT XMLRPC_FIND_QUIETLY)
- message(STATUS "${XMLRPC_DIR_MESSAGE}")
- else()
- if(XMLRPC_FIND_REQUIRED)
- message(FATAL_ERROR "${XMLRPC_DIR_MESSAGE}")
- endif()
- endif()
-endif()
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+ XMLRPC
+ REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES XMLRPC_INCLUDE_DIRS
+ FAIL_MESSAGE "XMLRPC was not found. Make sure the entries XMLRPC_* are set.")