From 88456744f809da7cf6b8417d3d74403969b0a144 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Mon, 7 Jun 2021 16:24:33 +0100 Subject: [PATCH] Check that calling the tools didn't fail If the tool does fail we'll either fail to include the generated file on the next line, or ignore the error and continue using stale config --- 32blit-config.cmake | 11 +++++++++-- 32blit-sdl/CMakeLists.txt | 9 ++++++++- 32blit-stm32/executable.cmake | 9 ++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/32blit-config.cmake b/32blit-config.cmake index 019cfe196..657666c40 100644 --- a/32blit-config.cmake +++ b/32blit-config.cmake @@ -24,7 +24,7 @@ if (NOT DEFINED BLIT_ONCE) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Release") endif() - + if(WIN32) add_definitions("-DWIN32") endif() @@ -36,7 +36,14 @@ if (NOT DEFINED BLIT_ONCE) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) # get the inputs/outputs for the asset tool (at configure time) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ttblit --debug cmake --config ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} --output ${CMAKE_CURRENT_BINARY_DIR} --cmake ${CMAKE_CURRENT_BINARY_DIR}/assets.cmake) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -m ttblit --debug cmake --config ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} --output ${CMAKE_CURRENT_BINARY_DIR} --cmake ${CMAKE_CURRENT_BINARY_DIR}/assets.cmake + RESULT_VARIABLE TOOL_RESULT + ) + if(${TOOL_RESULT}) + message(FATAL_ERROR "Reading asset config failed!\n") + endif() + include(${CMAKE_CURRENT_BINARY_DIR}/assets.cmake) # do asset packing (at build time) diff --git a/32blit-sdl/CMakeLists.txt b/32blit-sdl/CMakeLists.txt index d9e6b26d9..373cbcdcd 100644 --- a/32blit-sdl/CMakeLists.txt +++ b/32blit-sdl/CMakeLists.txt @@ -237,7 +237,14 @@ function(blit_metadata TARGET FILE) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${FILE}) # parse the metadata to variables - execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake + RESULT_VARIABLE TOOL_RESULT + ) + if(${TOOL_RESULT}) + message(FATAL_ERROR "Reading metadata config failed!\n") + endif() + include(${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake) if(APPLE) diff --git a/32blit-stm32/executable.cmake b/32blit-stm32/executable.cmake index a831d0f85..da8ff39bf 100644 --- a/32blit-stm32/executable.cmake +++ b/32blit-stm32/executable.cmake @@ -56,7 +56,14 @@ function(blit_metadata TARGET FILE) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${FILE}) # get the inputs/outputs for the asset tool (at configure time) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake + RESULT_VARIABLE TOOL_RESULT + ) + if(${TOOL_RESULT}) + message(FATAL_ERROR "Reading metadata config failed!\n") + endif() + include(${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake) if(${CMAKE_VERSION} VERSION_LESS "3.15.0")