Skip to content

Commit

Permalink
CMake: check return code of python scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Nov 18, 2024
1 parent a9a08d8 commit efc8504
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids
if(Python_FOUND)
message(STATUS "Generating 'fastfetch_pciids.c.inc'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc"
RESULT_VARIABLE PYTHON_PCIIDS_RETCODE)
if(NOT PYTHON_PCIIDS_RETCODE EQUAL 0)
message(FATAL_ERROR "Failed to generate 'fastfetch_pciids.c.inc'")
endif()
else()
message(WARNING "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
set(ENABLE_EMBEDDED_PCIIDS OFF)
Expand All @@ -282,7 +286,11 @@ endif()
if(Python_FOUND)
message(STATUS "Generating 'fastfetch.1'")
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-man.py"
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch.1")
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch.1"
RESULT_VARIABLE PYTHON_MANPAGE_RETCODE)
if(NOT PYTHON_MANPAGE_RETCODE EQUAL 0)
message(FATAL_ERROR "Failed to generate 'fastfetch.1'")
endif()
else()
message(WARNING "Python3 is not found, use basic 'fastfetch.1.in' instead")
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
Expand Down

0 comments on commit efc8504

Please sign in to comment.