How do cmake policy warnings work?

I’m looking for clarification on how cmake policy warnings work. In particular the policy warnings for CMP0112.

We have code that triggers the warning for CMP0112. We validated our usage is fine and use

cmake_policy(SET CMP0112 NEW)

However, whenever we use the --trace-expand flag to investigate issues we’re having. The output is inundated with warnings for CMP0112 saying it’s not set, blah, blah, blah.

CMake Warning (dev):
  Policy CMP0112 is not set: Target file component generator expressions do
  not add target dependencies.  Run "cmake --help-policy CMP0112" for policy
  details.  Use the cmake_policy command to set the policy and suppress this

  Dependency being added to target:


This warning is for project developers.  Use -Wno-dev to suppress it.

I saw a reference to CMAKE_POLICY_WARNING_CMP0112 in the description of CMP0112 which seems to imply that this warning is turned on no matter what if we are running in trace mode or debug mode.

Is this understanding correct? And if so, how do I stop it.

I’ve used code to deal with this. I never want to see this warning again, it’s not a problem, how do I get this to not show up even under debug or trace mode? I only want to see warnings for things that haven’t been taken care of.

I don’t want to use -Wno-dev because I don’t want to suppress all warnings, just the ones we’ve already taken care of.

These warnings are red herrings.

Can you please provide a test case that can be used to investigate the problem more deeply? There may just be a bug in the policy behavior detection (or the behavior is happening outside of the policy scope you’re setting…). Hard to say with the details provided at the moment.


I got distracted and didn’t get back to this until now, and 28 days later… I no longer remember the context myself, nor can I find the context. I’m guessing it was an experimental package I was working with/testing that I’ve since forgotten.

Apologies, for not following up in a timely manner or with necessary information.