Breaking change to app build scripts


Sebastian Boe
 

Hi all,

to silence the 'policy CMP000' warning[0] we have decided to
require that all 'app' CMakeLists.txt build scripts invoke the
function 'cmake_minimum_required'.

This requirement is a breaking change, not updating will result
in an error[1]. To resolve the error this line must
be added to the top of the 'app' CMakeLists.txt file:

cmake_minimum_required(VERSION 3.8.2)

E.g. to update the 'hello_world' sample one could execute:

sed -i '1s;^;cmake_minimum_required(VERSION 3.8.2)\n;' $ZEPHYR_BASE/samples/hello_world/CMakeLists.txt

See PR https://github.com/zephyrproject-rtos/zephyr/pull/9186 for more details.

[0] The warning shown when cmake >= 3.9 is used.
CMake Deprecation Warning at boilerplate.cmake:38 (cmake_policy):
The OLD behavior for policy CMP0000 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
CMakeLists.txt:2 (include)

[1] The error shown if no 'cmake_minimum_required' line is present.
CMake Error in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.12)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".