Skip to content

Do not overwrite Python_ADDITIONAL_VERSIONS #2128

Closed
@Flamefire

Description

@Flamefire

Issue description

Currently the pybind11 CML sets Python_ADDITIONAL_VERSIONS no matter what. This leads to problems with the current (2.4.3) release when Python 3.8 is available next to some older Python. Normally a recentish CMake would find Python 3.8 just fine, but due to pybind11 setting Python_ADDITIONAL_VERSIONS to 3.7 ... it will search for 3.7 first (and finds the older version somewhere in the system)

A user could generically use cmake -DPython_ADDITIONAL_VERSIONS=3.8 ... to have any project search for this version first. But here pybind11 overwrites this so it has no effect.

Suggestion: Use list(APPEND Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 ...) This has been available since at least CMake 3.0 (can't find the docs for 2.8 easily but I'd recommend to switch to >=3.1 anyway. older ones have some weird behaviour corner cases)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions