[CMake] MESSAGE SEND_ERROR and FATAL_ERROR

Filipe Sousa filipe at ipb.pt
Wed Jan 25 09:30:56 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bill Hoffman wrote:
> I want to change SEND_ERROR to do a FATAL_ERROR in the MESSAGE command.
> This it to make the required modules stop processing the cmakelist files
> at the first SEND_ERROR.   Currently it works like this:
> 
> SEND_ERROR: prevents the generate step from happening, but cmake continues
> to process files during the configure step.
> 
> FATAL_ERROR: cmake sends a message and immediately stops the configure step
> and does not process any more files.
> 

Until now, In didn't know what was the difference between the two. The
help is not clear enough

MESSAGE
    Display a message to the user.

        MESSAGE([SEND_ERROR | STATUS | FATAL_ERROR]
               "message to display" ...)

    The arguments are messages to display.  If the first argument is
    SEND_ERROR then an error is raised.  If the first argument is STATUS
    then the message is displayed in the progress line for the GUI.

While you are at it, what do you think of having an option to suppress
new lines at end of message.

Instead of

MESSAGE(STATUS "Checking for mylib --")
FIND_LIBRARY(MY_LIB ...)
IF (MY_LIB)
  MESSAGE(STATUS "Checking for mylib -- found")
ELSE(MY_LIB)
  MESSAGE(STATUS "Checking for mylib -- not found")
ENDIF(MY_LIB)

We could write

MESSAGE(STATUS "Checking for mylib --")
FIND_LIBRARY(MY_LIB ...)
IF (MY_LIB)
  MESSAGE(STATUS "found\n")
ELSE(MY_LIB)
  MESSAGE(STATUS "not found\n")
ENDIF(MY_LIB)

- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD14ugbQdNYqwwwCwRAii2AJ9i/ALVaK27WS0B1OcMybC1s9hiwQCfV9bu
BRjH6ulESIBZYbBbZa2sSrA=
=eizL
-----END PGP SIGNATURE-----


More information about the CMake mailing list