Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Dec 2020 00:01:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 252277] cmake find_package(python3...) fails to get default python version
Message-ID:  <bug-252277-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D252277

            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@FreeBSD.org
          Reporter: FreeBSD@ShaneWare.Biz

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

with cmake >=3D 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")=20

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=20


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

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-252277-7788>