From 7ce493f999d330702a3000a30bb88a281ca56aae Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 29 Mar 2022 08:23:13 -0700 Subject: [PATCH] CMake: consolidate Python checks This essentially removes the conditional check, when an unconditional check was already being performed later. --- CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f49cf246d..0d5b21f43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,13 +157,13 @@ if(${CMAKE_VERSION} VERSION_LESS "3.12.0") else() find_package(Python3 COMPONENTS Interpreter) endif() +if(NOT Python3_EXECUTABLE) + message(FATAL_ERROR "Python 3 not found") +endif() if(DEFINED VERSION) set(GRAPHVIZ_VERSION_STRING "${VERSION}") else() - if(NOT Python3_EXECUTABLE) - message(FATAL_ERROR "Python 3 not found") - endif() execute_process( COMMAND ${Python3_EXECUTABLE} gen_version.py WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" @@ -178,9 +178,6 @@ else() endif() endif() -if(NOT Python3_EXECUTABLE) - message(FATAL_ERROR "Python 3 not found") -endif() # Set GRAPHVIZ_VERSION_BUILD to time of last commit, or to 0 if that fails. execute_process( COMMAND ${Python3_EXECUTABLE} gen_version.py --committer-date-graphviz -- 2.40.0