]> granicus.if.org Git - graphviz/commitdiff
CMake: consolidate Python checks
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 29 Mar 2022 15:23:13 +0000 (08:23 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 3 Apr 2022 03:10:45 +0000 (20:10 -0700)
This essentially removes the conditional check, when an unconditional check was
already being performed later.

CMakeLists.txt

index f49cf246d86df0484a3f7da45d1c68e13e01822b..0d5b21f431b2832de84b58d2008de56f8acd8916 100644 (file)
@@ -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