[Bug 252277] cmake find_package(python3...) fails to get default python version

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Dec 30 00:01:12 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252277

            Bug ID: 252277
           Summary: cmake find_package(python3...) fails to get default
                    python version
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs at FreeBSD.org
          Reporter: FreeBSD at ShaneWare.Biz

In older cmake versions, we would use
  find_package(PythonInterp 3.4 REQUIRED)
  find_package(PythonLibs 3.4 REQUIRED)

with cmake >= 3.12 we can replace that with
  find_package(Python3 3.4 REQUIRED COMPONENTS Interpreter Development)

The old method will find the python version matching the python version set in
DEFAULT_VERSIONS

The newer python3 method always gets the largest python version installed, not
the default version.


example using old method (CORRECT) - find_package(PythonLibs 3.4 REQUIRED)

-- Found PythonLibs: /usr/local/lib/libpython3.7m.so (found suitable version
"3.7.9", minimum required is "3.4") 

change this to new method (WRONG) - find_package(Python3 3.4 REQUIRED
COMPONENTS Interpreter Development)

-- Found Python3: /usr/local/bin/python3.9 (found suitable version "3.9.0",
minimum required is "3.4") found components: Interpreter Development
Development.Module Development.Embed 


The new way should find the same py3.7

This is using cmake 3.18.5 and still applies to 3.19.2 found in bug #251920

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list