From b1aa8a4773da5fb4e0d4ee9b7fd224ed9bdbba31 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 11 Oct 2017 10:30:29 -0400
Subject: FindXMLRPC: Drop unnecessary exec_program code paths

We always have `execute_process` now, so drop our ancient `exec_program`
code paths that are never used anymore.
---
 Modules/FindXMLRPC.cmake | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index f0b2583..d857382 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -43,20 +43,12 @@ endif()
 
 # Lookup the include directories needed for the components requested.
 if(XMLRPC_C_FOUND)
-  # Use the newer EXECUTE_PROCESS command if it is available.
-  if(COMMAND EXECUTE_PROCESS)
-    execute_process(
-      COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags
-      OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS
-      OUTPUT_STRIP_TRAILING_WHITESPACE
-      RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT
-      )
-  else()
-    exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --cflags"
-      OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS
-      RETURN_VALUE XMLRPC_C_CONFIG_RESULT
-      )
-  endif()
+  execute_process(
+    COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags
+    OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT
+    )
 
   # Parse the include flags.
   if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0")
@@ -80,20 +72,12 @@ endif()
 
 # Lookup the libraries needed for the components requested.
 if(XMLRPC_C_FOUND)
-  # Use the newer EXECUTE_PROCESS command if it is available.
-  if(COMMAND EXECUTE_PROCESS)
-    execute_process(
-      COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs
-      OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS
-      OUTPUT_STRIP_TRAILING_WHITESPACE
-      RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT
-      )
-  else()
-    exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --libs"
-      OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS
-      RETURN_VALUE XMLRPC_C_CONFIG_RESULT
-      )
-  endif()
+  execute_process(
+    COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs
+    OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT
+    )
 
   # Parse the library names and directories.
   if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0")
-- 
cgit v0.12


From e7720a0f3f695b55b876689180e32d6c2fc5343c Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 11 Oct 2017 10:32:21 -0400
Subject: FindXMLRPC: Tolerate no include directories

`xmlrpc-c-config $modules --cflags` may report no `-I` flags if the
headers are in a standard location like `/usr/include`.  In this case
it is okay for `XMLRPC_INCLUDE_DIRS` to be empty.

Ideally the `--cflags` output should be used as hints for a `find_path`
call to really find the headers as we do for other find modules, but
simply assuming no explicit include directories are needed is good
enough for now.

Fixes: #17347
---
 Modules/FindXMLRPC.cmake | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake
index d857382..e7ae919 100644
--- a/Modules/FindXMLRPC.cmake
+++ b/Modules/FindXMLRPC.cmake
@@ -57,6 +57,7 @@ if(XMLRPC_C_FOUND)
       XMLRPC_C_CONFIG_CFLAGS "${XMLRPC_C_CONFIG_CFLAGS}")
 
     # Look for -I options.
+    # FIXME: Use these as hints to a find_path call to find the headers.
     set(XMLRPC_INCLUDE_DIRS)
     foreach(flag ${XMLRPC_C_CONFIG_CFLAGS})
       if("${flag}" MATCHES "^-I(.+)")
@@ -123,5 +124,5 @@ endif()
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(
     XMLRPC
-    REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES XMLRPC_INCLUDE_DIRS
+    REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES
     FAIL_MESSAGE "XMLRPC was not found. Make sure the entries XMLRPC_* are set.")
-- 
cgit v0.12