-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Missing file pybind11Targets.cmake? #1733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
No? |
I have the same error while configuring onnx project via cmake (3.8.2).
The file "pybind11Targets.cmake" just missing in |
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. if(NOT (CMAKE_VERSION VERSION_LESS 3.0))
if(NOT PYBIND11_EXPORT_NAME)
set(PYBIND11_EXPORT_NAME "${PROJECT_NAME}Targets")
endif()
install(TARGETS pybind11 module embed
EXPORT "${PYBIND11_EXPORT_NAME}") # <--- create targets file
if(PYBIND11_MASTER_PROJECT)
install(EXPORT "${PYBIND11_EXPORT_NAME}"
NAMESPACE "${PROJECT_NAME}::"
DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})
endif()
endif() 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 # Check if pybind11 is being used directly or via add_subdirectory
set(PYBIND11_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_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 if(PYBIND11_MASTER_PROJECT)
install(EXPORT "${PYBIND11_EXPORT_NAME}"
NAMESPACE "${PROJECT_NAME}::"
DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})
endif() All in all, disabling the check and setting |
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. |
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:
The text was updated successfully, but these errors were encountered: