>> I thought using FindPythonInterp would be more portable than >> simply invoking "python" directly (i.e. using $PYTHON_EXECUTABLE).
> In case you want the newest version of any Python major, as in your > case, try > find_package(PythonInterp 2 REQUIRED). But you are right, this would > also successfully return you a 2.5. Or, if you want to prefer the python in the environment PATH, and then do your own version check to make sure it's suitable, use something like this: # http://www.cmake.org/cmake/help/v3.0/command/find_program.html find_program(PYTHON_EXECUTABLE python PATHS ENV PATH # look in the PATH environment variable NO_DEFAULT_PATH # do not look anywhere else... ) find_package(PythonInterp) And then after the find_package, you can do your own version check with the variables: PYTHON_VERSION_MAJOR='2' PYTHON_VERSION_MINOR='7' PYTHON_VERSION_PATCH='6' PYTHON_VERSION_STRING='2.7.6' and the VERSION_GREATER / VERSION_LESS arguments to the "if" command. HTH, David C. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake