[CMake] CMP0058 warning on configure-time generated source files

Brad King brad.king at kitware.com
Thu Oct 29 11:13:03 EDT 2015


On 10/29/2015 10:33 AM, Sylvain Joubert wrote:
> I recently upgraded to CMake >= 3.3 and I get a CMP0058 warning on some
> of the generated files. What I don't understand is that:
> - These files are not generated at build time but at configure time,
>   why can't they just be seen as regular source files?

They can, but CMake does not know that for sure so it warns about the
policy's behavior change just in case.  In your case you know everything
is okay so you can go ahead and tell CMake to use its new preferred
behavior because it won't break anything.

All you have to do is add the code:

 if(POLICY CMP0058)
   cmake_policy(SET CMP0058 NEW)
 endif()

You can drop that in the future when you use

 cmake_minimum_required(VERSION 3.3)

which will set the policy to NEW automatically.

See further details in the policy docs:

 https://cmake.org/cmake/help/v3.3/policy/CMP0058.html
 https://cmake.org/cmake/help/v3.3/manual/cmake-policies.7.html
 https://cmake.org/cmake/help/v3.3/command/cmake_policy.html

-Brad



More information about the CMake mailing list