summaryrefslogtreecommitdiffstats
path: root/CMakeScripts
diff options
context:
space:
mode:
authorEduard Braun <Eduard.Braun2@gmx.de>2017-06-09 21:15:03 +0000
committerEduard Braun <Eduard.Braun2@gmx.de>2017-06-09 21:15:03 +0000
commit97eef4936224daa3713ba8345102ec09c676ea8a (patch)
tree93b1b472b4e0873d56fbb9e44d3e404d41efa53c /CMakeScripts
parentcmake/MSYS2: Update for libicu58 (diff)
downloadinkscape-97eef4936224daa3713ba8345102ec09c676ea8a.tar.gz
inkscape-97eef4936224daa3713ba8345102ec09c676ea8a.zip
cmake/MSYS2: Improve error output in case of for failing shell scripts in list_files_pacman / list_files_pip
(see https://bugs.launchpad.net/inkscape/+bug/1696720)
Diffstat (limited to 'CMakeScripts')
-rw-r--r--CMakeScripts/HelperFunctions.cmake27
1 files changed, 19 insertions, 8 deletions
diff --git a/CMakeScripts/HelperFunctions.cmake b/CMakeScripts/HelperFunctions.cmake
index 3cd9e2736..a9d7e0ab1 100644
--- a/CMakeScripts/HelperFunctions.cmake
+++ b/CMakeScripts/HelperFunctions.cmake
@@ -35,16 +35,27 @@ endfunction()
# Checks if the last call to execute_process() was sucessful and throws an error otherwise.
# ${result} and ${stderr} should hold the value of RESULT_VARIABLE and ERROR_VARIABLE respectively
-function(check_error result stderr)
+# ${command} can be empty or the command that was executed during the last call of execute_process()
+function(check_error result stderr command)
+ string(STRIP "${result}" result)
+ string(STRIP "${stderr}" stderr)
+ string(STRIP "${command}" command)
+
+ if ("${command}" STREQUAL "")
+ set(command "Process")
+ else()
+ set(command "'${command}'")
+ endif()
+
if("${result}" STREQUAL 0)
if(NOT "${stderr}" STREQUAL "")
- MESSAGE(WARNING "Process returned sucessfully but the following was output to stderr: ${stderr}")
+ MESSAGE(WARNING "${command} returned sucessfully but the following was output to stderr: ${stderr}")
endif()
else()
if("${stderr}" STREQUAL "")
- MESSAGE(FATAL_ERROR "Process failed with error code: ${result}")
+ MESSAGE(FATAL_ERROR "${command} failed with error code: ${result}")
else()
- MESSAGE(FATAL_ERROR "Process failed with error code: ${result} (stderr: ${stderr})")
+ MESSAGE(FATAL_ERROR "${command} failed with error code: ${result} (stderr: ${stderr})")
endif()
endif()
endfunction(check_error)
@@ -64,7 +75,7 @@ function(list_files_pacman package_name file_list)
RESULT_VARIABLE res
ERROR_VARIABLE err
)
- check_error("${res}" "${err}")
+ check_error("${res}" "${err}" "pacman -Ql ${MINGW_PACKAGE_PREFIX}-${package_name}")
# clean up output
execute_process(
@@ -77,7 +88,7 @@ function(list_files_pacman package_name file_list)
RESULT_VARIABLE res
ERROR_VARIABLE err
)
- check_error("${res}" "${err}")
+ check_error("${res}" "${err}" "Parsing result of 'pacman -Ql ${MINGW_PACKAGE_PREFIX}-${package_name}'")
SET(${file_list} ${out} PARENT_SCOPE)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/list_files_pacman_temp.txt)
@@ -95,7 +106,7 @@ function(list_files_pip package_name file_list)
RESULT_VARIABLE res
ERROR_VARIABLE err
)
- check_error("${res}" "${err}")
+ check_error("${res}" "${err}" "pip show -f ${package_name}")
# clean up output
execute_process(
@@ -107,7 +118,7 @@ function(list_files_pip package_name file_list)
RESULT_VARIABLE res
ERROR_VARIABLE err
)
- check_error("${res}" "${err}")
+ check_error("${res}" "${err}" "Parsing result of 'pip show -f ${package_name}'")
SET(${file_list} ${out} PARENT_SCOPE)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/list_files_pip_temp.txt)