Skip to content

pybind11_add_module unexpected error after PR #2368 #2373

@MonkeyBreaker

Description

@MonkeyBreaker

Issue description

After integrating latest PR #2368 on our library, building started producing errors:

 You have called ADD_LIBRARY for library '' without any source files. ...

After looking into the documentation, I could not find the issue, but looking into the PR, I saw that when using pybind11_add_module, it explicitly uses the keyword MODULE, and from what I understood in the documentation

MODULE or SHARED may be given to specify the type of library. If no type is given, MODULE is used by default which ensures the creation of a Python-exclusive module.

I don't know if it isn't any more the case. and now the MODULE keyword must be used?

Because when I use the keyword MODULE everything compiles just fine.

I tested pybind11 before the last merge of #2368 and without using the keyword MODULE it compiles just fine.

Reproducible example code

Maybe I'm crazy but the simple example from the documentation does not work on my machine:

cmake_minimum_required(VERSION 3.7)
project(example)

add_subdirectory(pybind11)
pybind11_add_module(example my_file.cpp)

Thank you for the great library,
Julián

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions