diff options
author | glx22 <glx@openttd.org> | 2021-04-24 17:52:21 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-04-24 21:16:06 +0200 |
commit | aca20092aadd65a764f1ea493c36f0ca507b32ff (patch) | |
tree | 65fb5cd3a1d17cd246dff249a228911b87760a4c /cmake/scripts | |
parent | e62ecbff16a1470aac2bb0dc830cdf129d1fb539 (diff) | |
download | openttd-aca20092aadd65a764f1ea493c36f0ca507b32ff.tar.xz |
Fix: [CMake] Check nforenum and grfcodec return value
Diffstat (limited to 'cmake/scripts')
-rw-r--r-- | cmake/scripts/CreateGRF.cmake | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/cmake/scripts/CreateGRF.cmake b/cmake/scripts/CreateGRF.cmake index 8631284f3..d47e39aa0 100644 --- a/cmake/scripts/CreateGRF.cmake +++ b/cmake/scripts/CreateGRF.cmake @@ -39,6 +39,20 @@ foreach(NFO_LINE IN LISTS NFO_LINES) endif() endforeach() -execute_process(COMMAND ${NFORENUM_EXECUTABLE} -s sprites/${GRF_SOURCE_FOLDER_NAME}.nfo) -execute_process(COMMAND ${GRFCODEC_EXECUTABLE} -n -s -e -p1 ${GRF_SOURCE_FOLDER_NAME}.grf) +execute_process(COMMAND ${NFORENUM_EXECUTABLE} -s sprites/${GRF_SOURCE_FOLDER_NAME}.nfo RESULT_VARIABLE RESULT) +if(RESULT) + if(NOT RESULT MATCHES "^[0-9]*$") + message(FATAL_ERROR "Failed to run NFORenum (${RESULT}), please check NFORENUM_EXECUTABLE variable") + endif() + message(FATAL_ERROR "NFORenum failed") +endif() + +execute_process(COMMAND ${GRFCODEC_EXECUTABLE} -n -s -e -p1 ${GRF_SOURCE_FOLDER_NAME}.grf RESULT_VARIABLE RESULT) +if(RESULT) + if(NOT RESULT MATCHES "^[0-9]*$") + message(FATAL_ERROR "Failed to run GRFCodec (${RESULT}), please check GRFCODEC_EXECUTABLE variable") + endif() + message(FATAL_ERROR "GRFCodec failed") +endif() + execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${GRF_SOURCE_FOLDER_NAME}.grf ${GRF_BINARY_FILE}) |