I am creating a virtual environment using CMake:
create_virtualenv(
PYTHON_EXE ${PY}
PATH ${VEN_DIR}
TARGET OUT_VENV
REQUIREMENTS_TXT ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt
)
One of the requirements in the CMake is PyBind11. Later in the same CMake file I have the following lines:
set (pybind11_DIR ${VEN_DIR}/site-packages/pybind11/share/cmake/pybind11)
set (Python_EXECUTABLE ${VENV_PYTHON})
set (PYBIND11_PYTHON_VERSION "3.6.9")
set (PYBIND11_FINDPYTHON ON)
find_package(pybind11 REQUIRED)
However, the find_package fails as the virtual environment is not yet setup and PyBind11 is not yet installed. If I create the virtual environment separately the find_package command works. How do I make find_package wait for the virtual environment to be set up?