CMake: Re-order PYTHON_VERSION check
authorCampbell Barton <ideasman42@gmail.com>
Sun, 8 Oct 2017 03:00:42 +0000 (14:00 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 8 Oct 2017 03:05:22 +0000 (14:05 +1100)
Missing paths would error first.

CMakeLists.txt

index 370c1ed520c18cbd723b6e7ce1110968e77b043f..b3a0dfa96ebbf53b0643d6ef78a9f8d333ac54a1 100644 (file)
@@ -758,6 +758,17 @@ if(WITH_INTERNATIONAL)
 endif()
 
 if(WITH_PYTHON)
 endif()
 
 if(WITH_PYTHON)
+       # While we have this as an '#error' in bpy_util.h,
+       # upgrading Python tends to cause confusion for users who build.
+       # Give the error message early to make this more obvious.
+       #
+       # Do this before main 'platform_*' checks,
+       # because UNIX will search for the old Python paths which may not exist.
+       # giving errors about missing paths before this case is met.
+       if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.6")
+               message(FATAL_ERROR "At least Python 3.6 is required to build")
+       endif()
+
        if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/scripts/addons/modules")
                message(WARNING
                        "Addons path '${CMAKE_SOURCE_DIR}/release/scripts/addons' is missing, "
        if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/scripts/addons/modules")
                message(WARNING
                        "Addons path '${CMAKE_SOURCE_DIR}/release/scripts/addons' is missing, "
@@ -1493,9 +1504,6 @@ endif()
 # with _any_ library but since we used a fixed python version this tends to
 # be most problematic.
 if(WITH_PYTHON)
 # with _any_ library but since we used a fixed python version this tends to
 # be most problematic.
 if(WITH_PYTHON)
-       if(${PYTHON_VERSION} VERSION_LESS "3.6")
-               message(FATAL_ERROR "Atleast Python 3.6 is required to build")
-       endif()
        if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
                message(FATAL_ERROR
                        "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
        if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
                message(FATAL_ERROR
                        "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"