2014-05-30 17:26:44 +02:00
|
|
|
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
|
2017-08-09 16:31:06 +02:00
|
|
|
"import distutils.sysconfig as cs; import os; import sys; v=cs.get_config_vars(); print(os.path.join(v['LIBDIR'],v['LDLIBRARY'])); sys.exit(0)"
|
2014-05-30 17:26:44 +02:00
|
|
|
RESULT_VARIABLE _PYLIB_SEARCH_SUCCESS
|
|
|
|
OUTPUT_VARIABLE _PYLIB_VALUES_OUTPUT
|
|
|
|
ERROR_VARIABLE _PYLIB_ERROR_VALUE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
2017-08-09 16:31:06 +02:00
|
|
|
message(${_PYLIB_SEARCH_SUCCESS})
|
|
|
|
|
2014-05-30 17:26:44 +02:00
|
|
|
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
|
|
|
|
"import distutils.sysconfig as cs; import os; v=cs.get_config_vars(); print(v['INCLUDEPY']);"
|
|
|
|
RESULT_VARIABLE _PYINC_SEARCH_SUCCESS
|
|
|
|
OUTPUT_VARIABLE _PYINC_VALUES_OUTPUT
|
|
|
|
ERROR_VARIABLE _PYINC_ERROR_VALUE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT _PYLIB_SEARCH_SUCCESS MATCHES 0)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"PyLib search failure:\n${_PYLIB_ERROR_VALUE}")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT _PYINC_SEARCH_SUCCESS MATCHES 0)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"PyInc search failure:\n${_PYINC_ERROR_VALUE}")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
set(PYTHON_LIBRARY ${_PYLIB_VALUES_OUTPUT} CACHE PATH "Python runtime library path")
|
|
|
|
set(PYTHON_INCLUDE_PATH ${_PYINC_VALUES_OUTPUT} CACHE PATH "Python runtime include path")
|