# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt

project(autopybind11 CXX)
cmake_minimum_required(VERSION 3.15)

enable_testing()
include(CTest)
configure_file(CTestCustom.cmake.in
  ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR})
find_package(AutoPyBind11)
# pybind11_SOURCE_DIR is an assumed variable
# If this repository is used by itself, should be empty and would clone in
# later execution.  If find_package("PyBind11") or an earlier
# FetchContnet was used, this will be populated and the existing directory will be used.
autopybind11_fetch_build_pybind11(PYBIND11_DIR ${pybind11_SOURCE_DIR})

if(Eigen_INCLUDE_DIR)
  message(STATUS "Eigen enabled, tests for Eigen support added")
  message(STATUS "Eigen located at ${Eigen_INCLUDE_DIR}")
endif()

add_subdirectory(Tests)
add_test(NAME lint_lib COMMAND pycodestyle ${CMAKE_SOURCE_DIR}/autopybind11/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# TODO(someone else?): Fix linting for examples / tests.
# add_test(NAME lint_example COMMAND pycodestyle ${CMAKE_SOURCE_DIR}/example/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
