diff --git a/cmake/MakePythonWheel.cmake b/cmake/MakePythonWheel.cmake index 4579bf2b5..805669646 100644 --- a/cmake/MakePythonWheel.cmake +++ b/cmake/MakePythonWheel.cmake @@ -9,7 +9,19 @@ function( MakeWheel python_module) cmake_parse_arguments(MAKEWHEEL "PRINT_HELP" "MODULE;VERSION;SUMMARY;DESCRIPTION;HOMEPAGE;AUTHOR;EMAIL;LICENCE" "REQUIRES" ${ARGN} ) set(version ${MAKEWHEEL_VERSION}) - execute_process(COMMAND ${Python3_EXECUTABLE} -c "import setuptools" ERROR_QUIET RESULT_VARIABLE has_setuptools) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c " +import sys +try: + import setuptools + sys.exit(0) +except ImportError as e: + print(f'{e}. Search paths:', file=sys.stderr) + for p in sys.path: print(f' {p}', file=sys.stderr) + sys.exit(1) +" + ERROR_QUIET RESULT_VARIABLE has_setuptools) + if(has_setuptools EQUAL "1") message(FATAL_ERROR "Python module `setuptools` required for correct wheel filename generation.") endif()