minor cmake cleanups

This commit is contained in:
Wenzel Jakob 2016-10-09 20:10:49 +02:00
parent c3d8b8cf42
commit 6a1734af23
2 changed files with 4 additions and 8 deletions

View File

@ -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)

View File

@ -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()