MantisBT - CMake
View Issue Details
0016069CMakeCMakepublic2016-04-16 03:492016-06-10 14:21
Craig Scott 
 
normalminoralways
closedno change required 
AppleOSX10.10
CMake 3.5.2 
 
0016069: Behaviour does not match documentation for policy CMP0048
The policy documentation for CMP0048 says this:

"This policy was introduced in CMake version 3.0. CMake version 3.5.2 warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly."

In my testing, however, no such warning is issued and the default appears to be NEW, not OLD.
The following minimal CMakeLists.txt demonstrates the problem:

cmake_minimum_required(VERSION 3.5.2)
cmake_policy(GET CMP0048 isOn)
message("isOn = ${isOn}")
project(proj VERSION 1.2.3)

Changing the minimum required version doesn't seem to make any difference.
If you explicitly set the policy for CMP0048 to OLD, then the expected error does occur when the project() command includes a VERSION specification.
No tags attached.
Issue History
2016-04-16 03:49Craig ScottNew Issue
2016-04-18 08:28Brad KingNote Added: 0040879
2016-04-18 08:28Brad KingStatusnew => resolved
2016-04-18 08:28Brad KingResolutionopen => no change required
2016-04-18 08:29Brad KingNote Added: 0040880
2016-06-10 14:21Kitware RobotNote Added: 0041190
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040879)
Brad King   
2016-04-18 08:28   
The call to cmake_minimum_required(VERSION):

 https://cmake.org/cmake/help/v3.5/command/cmake_minimum_required.html [^]

implies a call to cmake_policy(VERSION) which sets the policy to NEW because the min req version specified is at least 3.0. Once the policy is set the NEW behavior is used without any warning.
(0040880)
Brad King   
2016-04-18 08:29   
For reference, this behavior of cmake_minimum_required has been clarified in post-3.5 documentation updates:

 Help: Organize and clarify `cmake_minimum_required` documentation
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1dc8486b [^]
(0041190)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.