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

David Cole david.cole at kitware.com
Mon Jul 30 10:41:47 EDT 2012


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.hoffman at 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



More information about the cmake-developers mailing list