Skip to content

Commit efc8504

Browse files
committed
CMake: check return code of python scripts
1 parent a9a08d8 commit efc8504

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids
272272
if(Python_FOUND)
273273
message(STATUS "Generating 'fastfetch_pciids.c.inc'")
274274
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
275-
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
275+
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc"
276+
RESULT_VARIABLE PYTHON_PCIIDS_RETCODE)
277+
if(NOT PYTHON_PCIIDS_RETCODE EQUAL 0)
278+
message(FATAL_ERROR "Failed to generate 'fastfetch_pciids.c.inc'")
279+
endif()
276280
else()
277281
message(WARNING "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
278282
set(ENABLE_EMBEDDED_PCIIDS OFF)
@@ -282,7 +286,11 @@ endif()
282286
if(Python_FOUND)
283287
message(STATUS "Generating 'fastfetch.1'")
284288
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-man.py"
285-
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch.1")
289+
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch.1"
290+
RESULT_VARIABLE PYTHON_MANPAGE_RETCODE)
291+
if(NOT PYTHON_MANPAGE_RETCODE EQUAL 0)
292+
message(FATAL_ERROR "Failed to generate 'fastfetch.1'")
293+
endif()
286294
else()
287295
message(WARNING "Python3 is not found, use basic 'fastfetch.1.in' instead")
288296
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)

0 commit comments

Comments
 (0)