ceph/cmake/modules/FindCython.cmake
Kefu Chai 5e2bd7fc4d cmake: update FindPython* modules
use the ones shiped from the latest cmake. which

* enables us to find the recent python intepreter and development files,
* find intepreter and development in a single `find_pacakge()` command,
  simpler this way and less error prone.

and to accomodate this change:

* all `PYTHON${PYTHON_VERSION}_*` variables are renamed to
  `Python${PYTHON_VERSION}_*` if we use `find_package(Python2...)` or
  `find_package(Python3...)` to find python2 or python3 instead of using
  `find_package(Python...)`.
* use "2" explicitly when using python2, as `Python_*` variables are not
  defined anymore
* when compiling python support of ceph-mgr, continue using `Python_*`
  variables. because we find the python interpreter and development
  files using `find_pacakge(Python...)` for ceph-mgr.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2019-07-20 22:35:07 +08:00

17 lines
556 B
CMake

#
# Cython
#
# Try to run Cython, to make sure it works:
execute_process(
COMMAND ${Python${PYTHON_VERSION}_EXECUTABLE} -m cython --version
RESULT_VARIABLE cython_result
ERROR_VARIABLE cython_output)
if(cython_result EQUAL 0)
string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9]+).*" "\\1" CYTHON_VERSION "${cython_output}")
else()
message(SEND_ERROR "Could not find cython${PYTHON_VERSION}: ${cython_output}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cython${PYTHON_VERSION} DEFAULT_MSG CYTHON_VERSION)