cmake
deprecation_warning
ai_generated
true
CMake Warning (dev): Policy CMP0077 is not set: option() honors normal variables.
ID: cmake/policy-cmp-warning
88%Fix Rate
85%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3 | active | — | — | — |
Root Cause
CMake policy warning about deprecated behavior. Using OLD policy silences the warning but relies on behavior that will be removed.
genericWorkarounds
-
92% success Update code to comply with the NEW policy behavior
cmake_policy(SET CMP0077 NEW) # then update code to match new behavior
Sources: https://cmake.org/cmake/help/latest/command/find_package.html
-
88% success Set cmake_minimum_required to a version where the policy defaults to NEW
cmake_minimum_required(VERSION 3.24) # CMP0077 defaults to NEW since 3.13
-
85% success Use cmake_policy(SET CMPxxxx NEW) explicitly in the relevant scope
cmake_policy(SET CMP0077 NEW) # only if you understand the behavioral change
Dead Ends
Common approaches that don't work:
-
Set cmake_policy(SET CMPxxxx OLD) to suppress the warning
80% fail
OLD behavior is deprecated and will be removed in future CMake versions. This is a ticking time bomb.
-
Pin cmake_minimum_required to an old version to avoid the policy
85% fail
Locks entire project to old CMake features and behavior, not just the single policy.