You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have what looks like a successful installation of pybind11, but building another package on top of it causes a message that pybind11Targets.cmake is missing. Which it is.
There are one or two more tickets about this, but they kinda seem to have "gone away of their own accord".
My installation is nothing special:
cmake \
-D CMAKE_INSTALL_PREFIX=${PYBIND11_INSTALL} \
-D PYTHON_EXECUTABLE=`which python3` \
-D PYBIND11_INSTALL=ON \
-D PYBIND11_MASTER_PROJECT=ON \
-D PYBIND11_TEST=OFF \
${PYBIND11_SRC}```
(Some of those options are pure voodoo programming....)
Reacted by espdev, Evgeny Blokhin and Wei-Sheng Chin
I have the same error while configuring onnx project via cmake (3.8.2).
CMake Error at C:/B/pybind11/install/cmake/pybind11/pybind11Config.cmake:108 (include):
include could not find load file:
C:/B/pybind11/install/cmake/pybind11/pybind11Targets.cmake
Call Stack (most recent call first):
CMakeLists.txt:365 (find_package)
The file "pybind11Targets.cmake" just missing in cmake/pybind11 directory after configuring and installing pybind11 project.
I change CMakeLists.txt (just add message) and rebuilt INSTALL project in VS and the file was created. I do not know what's happening... maybe a bug in cmake.
I have the same issue and found a solution. In my case pybind11 was used in cmake using add_subdirectory(). Thus, the pybind11 check for being a master project in CMakesLists.txt line 22
# Check if pybind11 is being used directly or via add_subdirectoryset(PYBIND11_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIRSTREQUALCMAKE_SOURCE_DIR)
set(PYBIND11_MASTER_PROJECT ON)
endif()
ended up with PYBIND11_MASTER_PROJECT being turned off. This again only changes the behaviour in line 151
I've just run into this problem when trying to create a library that uses pybind11. I managed to work around it by installing the targets in my CMakeLists.txt, but I'm worried this is pretty fragile.
What breaks if the check on L151 is removed? I guess the targets don't need to be installed for an executable, but they are required for libraries.
Activity
VictorEijkhout commentedon Mar 25, 2019
No?
espdev commentedon Apr 9, 2019
I have the same error while configuring onnx project via cmake (3.8.2).
The file "pybind11Targets.cmake" just missing in
cmake/pybind11directory after configuring and installing pybind11 project.espdev commentedon Apr 9, 2019
And I do not know why the targets file was not created.
The code in CMakeLists.txt where Targets file should be created looks right.
I change CMakeLists.txt (just add message) and rebuilt INSTALL project in VS and the file was created. I do not know what's happening... maybe a bug in cmake.
costrau commentedon Jun 26, 2019
I have the same issue and found a solution. In my case pybind11 was used in cmake using
add_subdirectory(). Thus, the pybind11 check for being a master project in CMakesLists.txt line 22ended up with PYBIND11_MASTER_PROJECT being turned off. This again only changes the behaviour in line 151
All in all, disabling the check and setting
PYBIND11_MASTER_PROJECTtoonsolved the issue for me.ZedThree commentedon Jun 24, 2020
I've just run into this problem when trying to create a library that uses pybind11. I managed to work around it by installing the targets in my CMakeLists.txt, but I'm worried this is pretty fragile.
What breaks if the check on L151 is removed? I guess the targets don't need to be installed for an executable, but they are required for libraries.