CMP0069 warnings in internal CMake files
One of the goals of the #16665 (comment 236443) fix was to able to use toolchain to enable LTO so I don't have to modify existing CMakeLists.txt. It looks good with CMAKE_POLICY_DEFAULT_CMP0069=NEW
however produce tons of warnings in internal files:
# toolchain.cmake
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION YES)
# CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
project(foo)
add_executable(foo foo.cpp)
> rm -rf _builds
> cmake -H. -B_builds -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0069=NEW
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
CMake Warning (dev) at /.../_builds/CMakeFiles/CMakeTmp/CMakeLists.txt:14 (add_executable):
Policy CMP0069 is not set: INTERPROCEDURAL_OPTIMIZATION is enforced when
enabled. Run "cmake --help-policy CMP0069" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
INTERPROCEDURAL_OPTIMIZATION property will be ignored for target
'cmTC_eae59'.
What/how should be fixed here?