Re: [cmake-developers] User vs CMake include mismatch handling

2010-11-18 Thread Marcel Loose
 On 17-11-2010 at 23:28, in message
aanlktin6z9rxfqprwdux-qge4b_wych_fvy9dyo7d...@mail.gmail.com, David
Cole
david.c...@kitware.com wrote: 
 On Wed, Nov 17, 2010 at 4:50 PM, Alexander Neundorf
neund...@kde.org wrote:
 On Wednesday 17 November 2010, David Cole wrote:
 2010/11/17 Alexander Neundorf neund...@kde.org:
  On Thursday 14 October 2010, David Cole wrote:
  On Thu, Oct 14, 2010 at 1:30 PM, Alexander Neundorf
 neund...@kde.orgwrote:
   On Wednesday 13 October 2010, Alexander Neundorf wrote:
On Wednesday 13 October 2010, Bill Hoffman wrote:
 So, I think we have to use the new name approach.  Do we
want to
 call
  
   it
  
 2?  Or should we call it something else?

 Alex, do you have time to do this?
   
I think it's not a good solution, and the one with
CURRENT_LIST_DIR
is definitely better and already implemented.
And I am still convinced that I am right here, see my other
mails.
  
   So I would suggest to merge the CURRENT_LIST_DIR branch for
2.8.3, and
   as soon
   as 2.8.3 is released, remove the full paths again and enable
the new
   CMP0017
   instead (prefer CMAKE_ROOT when include()d from CMAKE_ROOT)
and then
   see what
   happens during the whole 2.8.4 cycle.
  
   I think this (CMP0017) is necessary, because otherwise we can
only
   hope nothing breaks with future releases (independent from
FPHSA).
  
   Alex
   ___
   cmake-developers mailing list
   cmake-developers@cmake.org
  
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
 
  I'm ok with this since Alex feels so strongly about it, and the
code
  change is restricted to using CMAKE_CURRENT_LIST_DIR only when
including
  FPHSA.cmake... (i.e. -- it should not affect including *other*
files
  from inside of modules that are presently overridden... which
was my
  concern -- that we'd break some *other* scenario -- since that's
not
  true, I retract my objection.)
 
  To review the change yourself:
git fetch stage
gitk remotes/stage/AddCMAKE_CURRENT_LIST_DIR
 
  Look at the top 3 commits. Looks pretty safe. I'd say we should
merge it
  to 'next' and then after a night on the dashboards, merge it to
'master'
  and do an rc3 release based on that.
 
  There is now a branch
 
PreferCMakeModulesByCMakeModulesWithPolicy-NoTrailingWhitespaceCommit
on
  stage.
  This contains right now only one commit, and that's the commit
which adds
  a policy which decides whether files in CMAKE_ROOT are preferred
over
  CMAKE_MODULE_PATH if include()d from withing CMAKE_ROOT.
 
  Currently (in this branch) this new policy is set to WARN, i.e.
still the
  old behaviour by default.
  As discussed, I think for this policy the default has to be new,
because
  otherwise it doesn't have the desired effect, (with WARN the
projects
  will break, but with warnings).
 
  So, are you ok if I set this policy to NEW by default ?
 
  I would also remove the full path for the
  include(FindPackageHandleStandardArgs) in this branch again.
 
  If there are no objections, I'll do this in the next days and
then merge
  into next.
 
  Alex

 It doesn't make sense to introduce a policy that defaults to NEW.
The
 reason for adding a policy is to *avoid breaking* existing
projects.

 The default / OLD behavior should not break anything. It is when
 switched to NEW that stuff might break.

 How is it that projects will break with the OLD behavior of this
 policy? If OLD breaks stuff, then it's not really OLD...

 Hmm, we discussed this here at length already...

 With no change in behaviour (i.e. old behaviour), if some cmake
module 
 inside
 CMAKE_ROOT does include(SomeFile), and then uses some features of
 SomeFile.cmake introduced in the same cmake version in a backward
compatible
 way, this breaks if there is another user-supplied SomeFile.cmake
in
 CMAKE_MODULE_PATH (maybe just a copy from the previous cmake
release),
 because that old SomeFile.cmake doesn't have yet the features
present in
 the current cmake version which the SomeFile.cmake-using module
expects to be
 present (because it's not forward-compatible).
 With this policy a module in CMAKE_ROOT can rely on the fact that it
also 
 gets
 the module it expects, i.e. the one also from CMAKE_ROOT and not
another,
 potentially old and incompatible one, from CMAKE_MODULE_PATH.

 That's why this policy has to be set to NEW to avoid breakage.

 The result from the discussion here was to use the full path as a
quick fix
 for 2.8.3, and as soon as this is out, use the new policy and see 
 whether/how
 much breakage there is.

 Alex

 
 We may have discussed it, but it was a while ago, and my brain can't
 recall specific details about how we arrived at this point.
 
 This policy, and all CMake policies should default to OLD. But if a
 project says cmake_minimum_required 2.8.4 ... then it can use the
NEW
 behavior.
 
 The old behavior is: do not load stuff from CMAKE_MODULE_PATH in a
 special manner. That should be the 

Re: [cmake-developers] User vs CMake include mismatch handling

2010-11-18 Thread Alexander Neundorf
On Thursday 18 November 2010, Marcel Loose wrote:
...
 Hi all,

 I've been following this discussion with interest for quite a while. I
 was wondering if both worlds could be united (Alex's and David's) if it
 were possible to set cmake_minimum_required on the command line? That
 way Alex can be happy, because he doesn't have to modify CMakeLists.txt
 files - something he cannot do for previous KDE releaeses; and David
 will be happy, because old projects will not suddenly break due to some
 incompatible changes in CMake.

This is a misunderstanding.
This whole discussion is not about old projects breaking due to *incompatible* 
changes in cmake, but about old projects breaking due to *fully backward 
compatible* changes in cmake.

A command line switch for cmake to switch policies to NEW or OLD sounds good 
to me. The cygwin guys probably would also like it.

Alex
___
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] User vs CMake include mismatch handling

2010-11-18 Thread Alexander Neundorf
On Thursday 18 November 2010, Brad King wrote:
 On 11/18/2010 04:29 AM, Marcel Loose wrote:
...
 This entire issue is about projects using CMAKE_MODULE_PATH to override
 standard CMake modules (accidentally or intentionally).  This policy
 changes the *granularity* at which that has to happen.  Previously
 a project could just copy out *one* module and modify it to fix
 something.  Now it would need to copy out all modules that depend on
 that module too.

 This is typically done to fix a bug or gain a feature without waiting
 for a new CMake release.  Ideally the project should have a separate
 entry in CMAKE_MODULE_PATH for each version of CMake, and then only
 add those corresponding to versions of CMake newer than or equal to
 that running.  IOW the outside project takes responsibility for the
 management of module override versions.

 Part of the design of policies is that the NEW behavior is clearly
 superior to the OLD behavior in design and function.  IMO, the NEW
 behavior of the proposed policy does not have this clear distinction.
 It makes the typical use case harder to do.

 This discussion should instead refocus on a way to make it easier for
 projects to deal with the above copy-and-fix-for-this-version use case.
 The approach should make it easy for CMake to know whether or not to
 honor a certain project module directory based on its version.

Ok.
Assume a project includes only a copy of FindZLIB.cmake from cmake 2.8.3 and 
applies the attached patch (or some similar simple patch).
Assume it does:

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/)
find_package(ZLIB)
find_package(PNG)


What should it do to make sure a future cmake release with fully backward 
compatible changes doesn't break its build ?

Alex
--- FindZLIB.cmake.orig	2010-11-18 20:33:12.0 +0100
+++ FindZLIB.cmake	2010-11-18 20:33:34.0 +0100
@@ -35,7 +35,7 @@ FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
 [HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include
 )
 
-SET(ZLIB_NAMES z zlib zdll)
+SET(ZLIB_NAMES z zlib zdll libz)
 FIND_LIBRARY(ZLIB_LIBRARY
 NAMES
 ${ZLIB_NAMES}
___
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers