Skip to content

cmake 3.17 dev warning from FindPythonInterp.cmake #23922

Closed
@chrta

Description

@chrta

Describe the bug

In cmake 3.17 the behaviour of FindPackageHandleStandardArgs https://cmake.org/cmake/help/v3.17/module/FindPackageHandleStandardArgs.html was modified. See cmake commit https://gitlab.kitware.com/cmake/cmake/commit/ee4673c1ae1e4a1aa4687412717567c2ffbb501b It now produces a warning on the current master.

To Reproduce
Steps to reproduce the behavior:

  1. west build -b efm32pg_stk3402a samples/hello_world
  2. See cmake warning message

Expected behavior

There should be no warning message.

Impact

There seems to be only the warning message for now, everything is still working.

Console output

$ west build -b efm32pg_stk3402a samples/hello_world/

-- west build: generating a build system
Including boilerplate (Zephyr base): /home/user/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/user/zephyrproject/zephyr/samples/hello_world
-- Zephyr version: 2.2.99 (/home/user/zephyrproject/zephyr)
CMake Warning (dev) at /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args`
  (PythonInterp) does not match the name of the calling package (Zephyr).
  This can lead to problems in calling code that expects `find_package`
  result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /home/user/zephyrproject/zephyr/cmake/backports/FindPythonInterp.cmake:175 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  /home/user/zephyrproject/zephyr/cmake/python.cmake:22 (include)
  /home/user/zephyrproject/zephyr/cmake/app/boilerplate.cmake:115 (include)
  /home/user/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /home/user/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
  CMakeLists.txt:5 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.9", minimum required is "3.6")
...

Environment (please complete the following information):

  • OS: Ubuntu 18.04 with cmake 3.17
  • Toolchain: Zephyr SDK
  • Commit SHA ba6dc5b (current master)

Possible Fix

This removed the warning, but i do not know if this is the proper fix for this:

diff --git a/cmake/backports/FindPythonInterp.cmake b/cmake/backports/FindPythonInterp.cmake
index 20eb7aebb3..0c0a361b53 100644
--- a/cmake/backports/FindPythonInterp.cmake
+++ b/cmake/backports/FindPythonInterp.cmake
@@ -171,6 +171,8 @@ if(PYTHON_EXECUTABLE)
 endif()
 
 include(FindPackageHandleStandardArgs)
+set(FPHSA_NAME_MISMATCHED 1)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
+unset(FPHSA_NAME_MISMATCHED)
 
 mark_as_advanced(PYTHON_EXECUTABLE)

Metadata

Metadata

Assignees

Labels

area: Build SystembugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions