Skip to content

[package] pybind11/2.9.1: pybind11_add_module not found #9343

Closed
@huweiATgithub

Description

@huweiATgithub

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: pybind11/2.9.1
  • Operating System+version: Windows 10
  • Compiler+version: VS 16 2019
  • Conan version: conan 1.44.1
  • Python version: Python 3.7.7

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
build_type=Debug
[options]
[conf]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

conanfile.txt

[requires]
pybind11/2.9.1

[generators]
CMakeDeps
CMakeToolchain

CMakeLists.txt

find_package(pybind11 REQUIRED)
include_directories("/path/to/python/include")
pybind11_add_module(example pybind.cpp lib.cpp)

Logs (Include/Attach if Applicable)

Click to expand log
-- Conan: Component target declared 'pybind11::main'
-- Conan: Component target declared 'pybind11::headers'
-- Conan: Component target declared 'pybind11::embed'
-- Conan: Component target declared 'pybind11::module'
-- Conan: Component target declared 'pybind11::python_link_helper'
-- Conan: Component target declared 'pybind11::windows_extras'
-- Conan: Component target declared 'pybind11::lto'
-- Conan: Component target declared 'pybind11::thin_lto'
-- Conan: Component target declared 'pybind11::opt_size'
-- Conan: Component target declared 'pybind11::python2_no_register'
-- Conan: Target declared 'pybind11::pybind11'
CMake Error at src/pybind/CMakeLists.txt:4 (pybind11_add_module):
  Unknown CMake command "pybind11_add_module".
-- Configuring incomplete, errors occurred!

Workarounds

This can be fixed by manually include the pybind11Tools.cmake file which defines the function pybind11_add_module.

It seems that conan generated config.cmake file does not include pybind11's tools definition file. Is this the designed behaviour or my settings might be wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions