Skip to content
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

[cmake] Do not set CMP0048 explicitly #6615

Merged
merged 1 commit into from
Aug 2, 2024
Merged

[cmake] Do not set CMP0048 explicitly #6615

merged 1 commit into from
Aug 2, 2024

Conversation

gruenich
Copy link
Contributor

@gruenich gruenich commented Jul 20, 2024

Since CMake 3.0 it is set implicitly to NEW, cppcheck requires CMake 3.5

https://cmake.org/cmake/help/latest/policy/CMP0048.html

@firewave
Copy link
Collaborator

Since CMake 3.0 it is set implicitly to NEW, cppcheck requires CMake 3.5

The documentation says that the policy was introduced with 3.0. and the behavior is actually documented as the opposite you are suggesting:

If it is not set, CMake warns, and uses OLD behavior.

This is supported by the project() at https://cmake.org/cmake/help/latest/command/project.html#options:

VERSION <version>

    Optional; may not be used unless policy CMP0048 is set to NEW.

I also checked all the individual release notes and there is no mention of this policy since it was introduced. I am having issues using the Wayback Machine so I could not check if the documentation changed over time.

But this does not match the behavior at all as it seems to work as intended (I am not 100% sure we test for the correct version somewhere) and no warning is written.

I always found these policies extremely confusing and not sufficiently documented (in some cases it always seemed impossible for them to work) when I had to deal with them. So no surprise here...

@gruenich
Copy link
Contributor Author

I always found these policies extremely confusing

I know what you mean. To me reading
https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html#introduction
always help to end my confusion.

CMP0048 was introduced with CMake 3.0, as this version changed the way to handle version variables. In case the required minimum CMake version was below 3.0, the policy was set to OLD. As cppcheck requires CMake 3.5, the policy is already set to NEW. I.e., my merge request removes a no-op.

Regarding CMP0048, as cppcheck set the project version when calling the project command, cppcheck is not affected anyways.

Since CMake 3.0 it is set implicitly to NEW, cppcheck requires CMake 3.5
@gruenich
Copy link
Contributor Author

Any reason to not merge this? Should I explain anything in more detail?

@chrchr-github chrchr-github merged commit 86cedde into danmar:main Aug 2, 2024
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants