Exploring the frequently used commands
CMake offers many scripting commands that allow you to work with variables and the environment. Some of them have been extensively covered in the Appendix: for example, list()
, string()
, and file()
. Others, such as find_file()
, find_package()
, and find_path()
, fit better in chapters that talk about their respective subjects. In this section, we will provide a brief overview of the common commands that are useful in most situations:
message()
include()
include_guard()
file()
execute_process()
Let’s get to it.
The message() command
We already know and love our trusty message()
command, which prints text to standard output. However, there’s a lot more to it than meets the eye. By providing a MODE
argument, you can customize the behavior of the command like so: message(<MODE> "text to print")
.
The recognized modes are as follows:
FATAL_ERROR
: This stops...