Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2013-04-24 Thread Chris
chris developerchris@... writes:

I should add the commandline for this build

emerge debug: cmake -G MinGW Makefiles  -DBUILD_doc=OFF 
-DCMAKE_INSTALL_PREFIX=r:/ -DCMAKE_INCLUDE_PATH=r:/include
-DCMAKE_LIBRARY_PATH=r:/lib -DCMAKE_PREFIX_PATH=r:/
-DCMAKE_BUILD_TYPE=RelWithDebInfo q:\kate
emerge debug: executing command: cmake -G MinGW Makefiles  -DBUILD_doc=OFF
 -DCMAKE_INSTALL_PREFIX=r:/ -DCMAKE_INCLUDE_PATH=r:/include
-DCMAKE_LIBRARY_PATH=r:/lib -DCMAKE_PREFIX_PATH=r:/
-DCMAKE_BUILD_TYPE=RelWithDebInfo q:\kate


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2013-04-24 Thread Brad King
On 04/24/2013 02:45 AM, chris wrote:
 when building packages I get errors like the following...
 
 CMake Error at /lib/cmake/KActivities/KActivitiesLibraryTargets.cmake:68 
 (message):
[snip]
 Call Stack (most recent call first):
/lib/cmake/KActivities/KActivitiesConfig.cmake:18 (include)
r:/share/apps/cmake/modules/MacroOptionalFindPackage.cmake:32 
 (find_package)
CMakeLists.txt:14 (macro_optional_find_package)

The KActivitiesConfig.cmake file is probably looking for things
relative to its own location but somehow it has been included
as /lib/cmake/... without a drive letter so paths computed
relative to its own location also do not have a drive letter.

Something is handing the find_package call a search path without
a drive letter.  Read the find_package docs here:

 http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command:find_package

to see the list of places it gets search paths.  Use message()
to print each one out just before the call to see which one has
the missing drive letter.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2013-04-24 Thread Brad King
On 04/24/2013 09:29 AM, DeveloperChris wrote:
 I had added some message lines to try and work out how it functions
 part of the log snippet I actually cut out was the following...
 |
 ||-- Found automoc4: R:/bin/automoc4.exe||
 ||-- the import prefix derived from 
 /lib/cmake/KActivities/KActivitiesLibraryTargets.cmake is :- 
 /lib/cmake/KActivities||
 ||-- the import prefix derived from /lib/cmake is :- /lib/cmake||
 ||-- the import prefix derived from /lib is :- /lib||
 ||-- the import prefix derived from / is :- /||
 ||-- the import prefix is :- /||
 ||CMake Error at /lib/cmake/KActivities/KActivitiesLibraryTargets.cmake:68 
 (message):||
 |
 
 So the import prefix is set to /

The above all happens inside files loaded by find_package.  The
problem is that they are being loaded through a path starting
in / and using that to compute the import prefix relative to
themselves.  This process is a victim of the real problem, not
the cause.

We need to figure out what tells find_package to look for and
load KActivitiesConfig.cmake from a path with no drive letter
in the first place.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2013-04-24 Thread Alexander Neundorf
On Wednesday 24 April 2013, Brad King wrote:
 On 04/24/2013 09:29 AM, DeveloperChris wrote:
  I had added some message lines to try and work out how it functions
  part of the log snippet I actually cut out was the following...
  
  ||-- Found automoc4: R:/bin/automoc4.exe||
  ||-- the import prefix derived from
  ||/lib/cmake/KActivities/KActivitiesLibraryTargets.cmake is :-
  ||/lib/cmake/KActivities|| -- the import prefix derived from /lib/cmake
  ||is :- /lib/cmake|| -- the import prefix derived from /lib is :- /lib||
  ||-- the import prefix derived from / is :- /||
  ||-- the import prefix is :- /||
  ||CMake Error at
  ||/lib/cmake/KActivities/KActivitiesLibraryTargets.cmake:68 (message):||
  
  So the import prefix is set to /
 
 The above all happens inside files loaded by find_package.  The
 problem is that they are being loaded through a path starting
 in / and using that to compute the import prefix relative to
 themselves.  This process is a victim of the real problem, not
 the cause.
 
 We need to figure out what tells find_package to look for and
 load KActivitiesConfig.cmake from a path with no drive letter
 in the first place.

Is it this one http://public.kitware.com/Bug/view.php?id=10994 ?

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-31 Thread Bill Hoffman

On 7/30/2012 3:38 PM, Alexander Neundorf wrote:

The idea was that this is a sign of a broken install.

Can you uninstall the vtk-devel package (does this exist ?), because it
is broken, i.e. does not contain everything is claims to ?

I understand that this is maybe not expected behaviour for an optional
package, but maybe Brad is right ?

Alex

Yes, VTK is broken on the machine, and we could fix the machine. 
However, this would be the first time we did a work around for the 
modules test by fixing the machine.  I wonder if we could just disable 
fatal error at the start of find_package optional.  Then turn it back on 
at the end.  My concern is optional packages, maybe that is a rare case 
not sure.


--
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
bill.hoff...@kitware.com
http://www.kitware.com
518 881-4905 (Direct)
518 371-3971 x105
Fax (518) 371-4573
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-31 Thread Alexander Neundorf
On Tuesday 31 July 2012, Bill Hoffman wrote:
 On 7/30/2012 3:38 PM, Alexander Neundorf wrote:
  The idea was that this is a sign of a broken install.
  
  Can you uninstall the vtk-devel package (does this exist ?), because it
  is broken, i.e. does not contain everything is claims to ?
  
  I understand that this is maybe not expected behaviour for an optional
  package, but maybe Brad is right ?
  
  Alex
 
 Yes, VTK is broken on the machine, and we could fix the machine.
 However, this would be the first time we did a work around for the
 modules test by fixing the machine.  I wonder if we could just disable
 fatal error at the start of find_package optional.  Then turn it back on
 at the end.  My concern is optional packages, maybe that is a rare case
 not sure.

One reason why I wanted it to be an error was to force people to fix their 
install, make it is obvious that it is not the fault of the buildsystem of the 
project being built, but of the package being used.

I'm not sure it is better to fail relatively silently in this case instead of 
complaining loudly that the package is broken.
Users might wonder why it doesn't work, the devel package is installed, in the 
right place, and still CMake doesn't pick it up.

I can have a look how to make it not an error if the find_package() is 
optional, if we really want that.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-31 Thread David Cole
On Tue, Jul 31, 2012 at 2:30 PM, Alexander Neundorf neund...@kde.org wrote:
 On Tuesday 31 July 2012, Bill Hoffman wrote:

 On 7/30/2012 3:38 PM, Alexander Neundorf wrote:

  The idea was that this is a sign of a broken install.

 

  Can you uninstall the vtk-devel package (does this exist ?), because it

  is broken, i.e. does not contain everything is claims to ?

 

  I understand that this is maybe not expected behaviour for an optional

  package, but maybe Brad is right ?

 

  Alex



 Yes, VTK is broken on the machine, and we could fix the machine.

 However, this would be the first time we did a work around for the

 modules test by fixing the machine. I wonder if we could just disable

 fatal error at the start of find_package optional. Then turn it back on

 at the end. My concern is optional packages, maybe that is a rare case

 not sure.

 One reason why I wanted it to be an error was to force people to fix their
 install, make it is obvious that it is not the fault of the buildsystem of
 the project being built, but of the package being used.

 I'm not sure it is better to fail relatively silently in this case instead
 of complaining loudly that the package is broken.

 Users might wonder why it doesn't work, the devel package is installed, in
 the right place, and still CMake doesn't pick it up.

 I can have a look how to make it not an error if the find_package() is
 optional, if we really want that.

 Alex


 --

 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

One thing Brad and I discussed briefly was simply changing our
generated code to something like this pseudo-code:

if(file is missing)
  if(optional)
message(WARNING package is broken -- file ${file} is missing)
set(FOUND FALSE)
# allow find_package to fall through to trying to find the next
installation of this package if there are more possibilities...
  else()
message(FATAL_ERROR as we have now and have had since 2.8.7)
  endif()
endif()

And then you still have to possibly deal with non-generated
misbehaving project config files, but at least for the scripts we
generate that get included at find_package time, we will not trigger
an error in the optional case.

How does that sound as a compromise position?

Either way, I vote to put this into 'master' immediately AFTER 2.8.9,
and not hold up the release for trying to rush in a last minute change
of this magnitude. I think it's too risky, and the behavior exists in
2.8.7 and 2.8.8 already.


David C.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-31 Thread Brad King
On 07/31/2012 02:30 PM, Alexander Neundorf wrote:
 On Tuesday 31 July 2012, Bill Hoffman wrote:
 I wonder if we could just disable fatal error at the start of
 find_package optional. Then turn it back on at the end.

As I pointed out elsewhere in this thread fatal errors are just
one way a failure can occur inside find_package when a package
is broken.  Total sandboxing is not realistic.  Partial sandboxing
just pushes the underlying problem on a given machine over the
horizon.

 One reason why I wanted it to be an error was to force people
 to fix their install, make it is obvious that it is not the
 fault of the buildsystem of the project being built, but of the
 package being used.

Yes.

 I'm not sure it is better to fail relatively silently in this
 case instead of complaining loudly that the package is broken.

 Users might wonder why it doesn't work, the devel package is
 installed, in the right place, and still CMake doesn't pick it
 up.

IMO once find_package locates a package configuration file the
corresponding package *has* been found.  If the package is broken
failure can occur at a number of different times:

(1) The package config .cmake file reports a problem.
(2) CMake succeeds but compilation fails due to a missing header
(3) Compilation works but linking fails due to a missing library
(4) Linking works but runtime fails due to a missing resource

The sandboxing approach can only hope to ignore packages that
will fail as case 1.  Even that may not be desirable.  If a
package is broken it is better to fix it or explicitly request
that it not be used than to automatically ignore it (silently
or loudly).  That way all failure cases for broken packages are
resolved in the same way.

 I can have a look how to make it not an error if the
 find_package() is optional, if we really want that.

I think a better solution is to allow specific package locations
to be explicitly disallowed by the user.  This gives them an
option to deal with broken packages if they are not an admin
on the machine capable of fixing it.  That way if the package
is an optional dependency and the only instance of it on the
system is broken the user still has a way to move forward.
I'm not sure how the interface might look or how to tell users
they may activate it.

David Cole suggested in a sibling to this message to lighten
the error message in target info files to a warning along
with setting package_FOUND to FALSE if the package is not
required.  This approach is complementary to the above proposal.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


[cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-30 Thread Bill Hoffman

Alex added this check:
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a2be068c

It guards against broken installations of packages.  This is a good 
thing.  However, it is causing a failed test:



http://open.cdash.org/buildSummary.php?buildid=2465838


--Checking FindVTK
CMake Error at //lib/vtk-5.8/VTKTargets-debug.cmake:996 (MESSAGE):
  The imported target vtkWrapTcl references the file

 //bin/vtkWrapTcl

  but this file does not exist.  Possible reasons include:


So, there is a bad config file for VTK on this machine.

However, if someone does an optional find_package it should not error 
out.   If you were building a project that you did not write the cmake 
files for and came across this error for an optional part of the system 
you might be stuck.  Not sure how to make the required bit propagate 
down to where this error is produced...


Thoughts?

-Bill
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-30 Thread David Cole
Seems like message(FATAL_ERROR/SEND_ERROR needs to know whether it's
in the middle of a find_package( OPTIONAL ) call or not.

What would happen if the only line of code in a project config file is:

  message(FATAL_ERROR not implemented yet)

And then somebody did a find_package(OPTIONAL on that package?

The contents of hand-written project config files are arbitrary, and
we can't stop people from putting FATAL_ERRORs in them. So we should
deal with it generically internal to CMake somehow.


  David C.


On Mon, Jul 30, 2012 at 10:33 AM, Bill Hoffman bill.hoff...@kitware.com wrote:
 Alex added this check:
  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a2be068c

 It guards against broken installations of packages.  This is a good thing.
 However, it is causing a failed test:


 http://open.cdash.org/buildSummary.php?buildid=2465838


 --Checking FindVTK
 CMake Error at //lib/vtk-5.8/VTKTargets-debug.cmake:996 (MESSAGE):
   The imported target vtkWrapTcl references the file

  //bin/vtkWrapTcl

   but this file does not exist.  Possible reasons include:


 So, there is a bad config file for VTK on this machine.

 However, if someone does an optional find_package it should not error out.
 If you were building a project that you did not write the cmake files for
 and came across this error for an optional part of the system you might be
 stuck.  Not sure how to make the required bit propagate down to where this
 error is produced...

 Thoughts?

 -Bill
 --

 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-30 Thread Brad King
On 07/30/2012 10:41 AM, David Cole wrote:
 Seems like message(FATAL_ERROR/SEND_ERROR needs to know whether it's
 in the middle of a find_package( OPTIONAL ) call or not.
 
 What would happen if the only line of code in a project config file is:
 
   message(FATAL_ERROR not implemented yet)
 
 And then somebody did a find_package(OPTIONAL on that package?
 
 The contents of hand-written project config files are arbitrary, and
 we can't stop people from putting FATAL_ERRORs in them. So we should
 deal with it generically internal to CMake somehow.

One could also have:

 $ cat lib/cmake/myproj/MyProjConfig.cmake
 Oops, this is not a CMake language file.  Uh oh.

and find_package could deal with it only by sandboxing the entire
load process.  This problem was not created by Alex's check.  His
check is only one instance of the conditions for the underlying
problem.

Sandboxing the entire operation is not achievable in our
current CMake language implementation.  It's not even fully
possible because the scripts could always do things that are
externally visible and not reversible like execute_process.

I'm not sure sandboxing any and all errors inside package
configuration files is the right thing either.  As a user
expecting find_package to locate a particular installation
that I do not know is corrupted I might bang my head against
the desk wondering why CMake is ignoring it.  We would have
to dump the entire output from the attempted/failed load as
a warning.

What do we do after such failure?  Ignore the instance and
continue to search for another one?  Consider the package
to be not found?  The answer should be consistent with what
happens since this change:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16c0c737

when a package config file sets package_FOUND to FALSE.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] find_package without REQUIRED can cause fatal error now

2012-07-30 Thread Alexander Neundorf
On Monday 30 July 2012, Bill Hoffman wrote:
 Alex added this check:
   http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a2be068c
 
 It guards against broken installations of packages.  This is a good
 thing.  However, it is causing a failed test:
 
 
 http://open.cdash.org/buildSummary.php?buildid=2465838
 
 
 --Checking FindVTK
 CMake Error at //lib/vtk-5.8/VTKTargets-debug.cmake:996 (MESSAGE):
The imported target vtkWrapTcl references the file
 
   //bin/vtkWrapTcl
 
but this file does not exist.  Possible reasons include:
 
 
 So, there is a bad config file for VTK on this machine.
 
 However, if someone does an optional find_package it should not error
 out.   If you were building a project that you did not write the cmake
 files for and came across this error for an optional part of the system
 you might be stuck.

The idea was that this is a sign of a broken install.
Can you uninstall the vtk-devel package (does this exist ?), because it is 
broken, i.e. does not contain everything is claims to ?

I understand that this is maybe not expected behaviour for an optional 
package, but maybe Brad is right ?

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers