View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012458CMakeCMakepublic2011-09-14 19:272012-04-02 10:10
ReporterStephen Kelly 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product VersionCMake 2.8.5 
Target VersionCMake 2.8.7Fixed in VersionCMake 2.8.7 
Summary0012458: cmake_minimum_required clears policies
DescriptionThe attached project contains the line

cmake_policy(SET CMP0017 NEW)

but also warns about the policy not being set:

$ cmake ..
CMake Warning (dev) at /usr/share/cmake-2.8/Modules/FeatureSummary.cmake:112 (INCLUDE):
  File /usr/share/cmake-2.8/Modules/FeatureSummary.cmake includes
  /home/stephen/dev/src/playground/cmakebugs/CMakeParseArguments.cmake (found
  via CMAKE_MODULE_PATH) which shadows
  /usr/share/cmake-2.8/Modules/CMakeParseArguments.cmake. This may cause
  errors later on .

  Policy CMP0017 is not set: Prefer files from the CMake module directory
  when including from there. Run "cmake --help-policy CMP0017" for policy
  details. Use the cmake_policy command to set the policy and suppress this
  warning.
Call Stack (most recent call first):
  sub1/CMakeLists.txt:4 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/stephen/dev/src/playground/cmakebugs/build

The warning does not appear if the cmake_minimum_required line in sub1/CMakeLists.txt is removed.

The documentation of cmake_minimum_required notes that the policy is implicitly set to the cmake version specified. However I still found it surprising that it clears all existing policies.

If this is intentional, it should probably be in the cmake_minimum_required documentation.
TagsNo tags attached.
Attached Filesgz file icon policybug.tar.gz [^] (378 bytes) 2011-09-14 19:27

 Relationships

  Notes
(0027425)
David Cole (manager)
2011-09-14 22:31

This behavior is completely intentional, and we will not be changing it. I'll take a look at the documentation to see if I can clarify it, but this is not urgent... We won't hold the 2.8.6 release for a fix on this, but we'll get it in for next time.
(0027646)
David Cole (manager)
2011-10-25 23:07

The documentation of cmake_minimum_required states:

-----
When a version higher than 2.4 is specified the command implicitly invokes

         cmake_policy(VERSION major[.minor[.patch[.tweak]]])
-----

So, naturally, you have to look at the documentation of cmake_policy(VERSION ...) to understand what happens there. And that documentation is quite explicit about setting all policies as of the VERSION number to NEW, and later policies to *unset* (unless variable CMAKE_POLICY_DEFAULT_CMP<NNNN> sets a default)

Not sure how to make it more clear without repeating ourselves...

Suggestions for how to make it more clear would be welcome.

If no reasonable suggestions arrive in this issue in the next week or so, I'll resolve it as "no change required..."
(0027817)
David Cole (manager)
2011-11-17 16:26

After more than three weeks with no additional comments, closing as "no change required," as promised. If anyone has further suggestions for clarifying the documentation here, please feel free to re-open.
(0029043)
David Cole (manager)
2012-04-02 10:10

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2011-09-14 19:27 Stephen Kelly New Issue
2011-09-14 19:27 Stephen Kelly File Added: policybug.tar.gz
2011-09-14 22:29 David Cole Assigned To => David Cole
2011-09-14 22:29 David Cole Status new => assigned
2011-09-14 22:31 David Cole Note Added: 0027425
2011-10-25 23:07 David Cole Note Added: 0027646
2011-10-27 00:05 David Cole Target Version => CMake 2.8.7
2011-11-17 16:26 David Cole Note Added: 0027817
2011-11-17 16:26 David Cole Status assigned => resolved
2011-11-17 16:26 David Cole Fixed in Version => CMake 2.8.7
2011-11-17 16:26 David Cole Resolution open => no change required
2012-04-02 10:10 David Cole Note Added: 0029043
2012-04-02 10:10 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team