Cause CMAKE to generate an error

The message() method has an optional argument for the mode, allowing STATUS, WARNING, AUTHOR_WARNING, SEND_ERROR, and FATAL_ERROR. STATUS messages go to stdout. Every other mode of message, including none, goes to stderr.

You want SEND_ERROR if you want to output an error, but continue processing.
You want FATAL_ERROR if you want to exit CMake processing.

Something like:

if( SOME_COND )
  message( SEND_ERROR "You can't do that" )
elseif( SOME_CRITICAL_COND )
  message( FATAL_ERROR "You can not do this at all, CMake will exit." )
endif()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)