correct usage of CMP0011

Hi,
I’m doing something like this:

INSTALL(SCRIPT "Path/Script.cmake")

In Script.cmake I’m doing a if (var IN_LIST list) which, according to cmake warnings, requires CMP0057 being set to NEW. Yet it seems that Script.cmake does not inherit the calling CMakeLists policies.
Setting CMP0057 inside Script.cmake rises a new warning implying policy CMP0011. I can silence the warning by setting CMP0011 to NEW inside Script.cmake but is it the right place to do it?
cmake_policy documentation (and CMP0011) left me confused.

Thx
A.

I think you might just want to use cmake_policy(VERSION 3.12) or whatever works best for you to set all policies to some modern settings.

Hi,

In my use case, the main CMakeLists does cmake_policy(VERSION x.y) but it seems that a delegated cmake script does not inherite it (see use-case in using read -p from in script launched by execute_process).

Thanks

No, a policy only applies to the cmake code that will be seen in the current execution. Anything that has another cmake -P involved will need its own policy settings.