mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
minor cmake cleanups
This commit is contained in:
parent
c3d8b8cf42
commit
6a1734af23
@ -25,6 +25,7 @@ set(PYBIND11_PYTHON_VERSION "" CACHE STRING "Python version to use for compiling
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/tools")
|
||||
set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7)
|
||||
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
|
||||
message(${PYTHONLIBS_FOUND})
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
|
@ -76,17 +76,12 @@ if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
|
||||
# Make sure pytest is found or produce a fatal error
|
||||
macro(pybind11_execute_python)
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ${ARGN} OUTPUT_QUIET ERROR_QUIET
|
||||
RESULT_VARIABLE pybind11_execute_python_error)
|
||||
endmacro()
|
||||
|
||||
if(NOT PYBIND11_PYTEST_FOUND)
|
||||
pybind11_execute_python(pytest --version --noconftest)
|
||||
if(pybind11_execute_python_error)
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pytest --version --noconftest OUTPUT_QUIET ERROR_QUIET
|
||||
RESULT_VARIABLE PYBIND11_EXEC_PYTHON_ERR)
|
||||
if(PYBIND11_EXEC_PYTHON_ERR)
|
||||
message(FATAL_ERROR "Running the tests requires pytest. Please install it manually (try: ${PYTHON_EXECUTABLE} -m pip install pytest)")
|
||||
endif()
|
||||
|
||||
set(PYBIND11_PYTEST_FOUND TRUE CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user