Consider example below:
cmake_minimum_required(VERSION 3.5)
project(HelloInstall)
if(POLICY CMP0060) # 3.3
cmake_policy(SET CMP0060 OLD)
endif()
if(POLICY CMP0129) # 3.23
cmake_policy(SET CMP0129 OLD)
endif()
if(POLICY CMP0130) # 3.24
cmake_policy(SET CMP0130 NEW)
endif()
add_executable(hello main.cpp)
install(TARGETS hello DESTINATION bin)
In cmake 3.31 I get warning on using CMP0129=OLD
behaviour.
Let’s say I still have users with older cmake (<=3.23) and then I want to keep it as OLD
.
So the only way for me to disable it is to use CMAKE_WARN_DEPRECATED=OFF
. But there are couple downsides:
-
it will disable
cmake_minimum_required
check, which is very important, since 3.5 compatibility already removed completely -
it will hide
CMP0060
warning, which is also very important, since this policy goes away with 3.5
Would be great to have some way to disable non-crucial deprecation warnings.
Also, maybe a dumb question, but shouldn’t policies removal coincide with general cmake version compatibility removal? And if I have cmake_minimum_required(VERSION 3.10)
, which is still compatible cmake version, I shouldn’t get any warnings about using OLD behaviour from cmake policies added in cmake 3.10+.