Skip to content

cmake: Fix dev warning from cmake 3.17 #23981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

chrta
Copy link
Collaborator

@chrta chrta commented Apr 1, 2020

In cmake 3.17 the behaviour of FindPackageHandleStandardArgs was modified.
See cmake commit FPHSA: detect package name mismatches
("ee4673c1ae1e4a1aa4687412717567c2ffbb501b").
This change introduces a new warning.

Fixes #23922

Signed-off-by: Christian Taedcke [email protected]

@zephyrbot
Copy link
Collaborator

zephyrbot commented Apr 1, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

Copy link
Collaborator

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a little safety around setting a variable.

Comment on lines 174 to 176
set(FPHSA_NAME_MISMATCHED 1)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
unset(FPHSA_NAME_MISMATCHED)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I don't expect this to be an issue in this case, then in general it is safer to read existing value, and restore that afterwards.

Suggested change
set(FPHSA_NAME_MISMATCHED 1)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
unset(FPHSA_NAME_MISMATCHED)
set(FPHSA_NAME_MISMATCHED_CURRENT ${FPHSA_NAME_MISMATCHED})
set(FPHSA_NAME_MISMATCHED 1)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
set(FPHSA_NAME_MISMATCHED ${FPHSA_NAME_MISMATCHED_CURRENT})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is better. Done.

In cmake 3.17 the behaviour of FindPackageHandleStandardArgs was
modified. See cmake commit FPHSA: detect package name mismatches
("ee4673c1ae1e4a1aa4687412717567c2ffbb501b").
This change introduces a new warning.

Fixes zephyrproject-rtos#23922

Signed-off-by: Christian Taedcke <[email protected]>
@tejlmand
Copy link
Collaborator

tejlmand commented Apr 9, 2020

@chrta I discovered that since CMake 3.12 (Zephyr requires minimum 3.13), the use of FindZephyrInterp has been deprecated in favor of FindPython3.
https://github.com/Kitware/CMake/blob/master/Modules/FindPythonInterp.cmake

Will test out FindPython3, and if that also fixes this old issue: #11103 , then we should simply switch to that, and remove this local copy.

@tejlmand tejlmand added the DNM This PR should not be merged (Do Not Merge) label Apr 9, 2020
@tejlmand
Copy link
Collaborator

#24308

@chrta
Copy link
Collaborator Author

chrta commented Apr 22, 2020

Close this because #24308 fixes this issue in a better way.

@chrta chrta closed this Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System DNM This PR should not be merged (Do Not Merge)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmake 3.17 dev warning from FindPythonInterp.cmake
3 participants