From 6a1734af23fd221826dd835e5bf2278d8bfa0272 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sun, 9 Oct 2016 20:10:49 +0200 Subject: [PATCH] minor cmake cleanups --- CMakeLists.txt | 1 + tests/CMakeLists.txt | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48d3cc7e..a54b11df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1cf5a8e6..684535a4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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()