Closed ghost closed 5 years ago
Hi and thanks for your interest in this project!
We use the convention that variables starting with an underscore are defined and used locally within one CMakeLists.txt
file. In your specific example all the variables starting with an underscore are used to store the results of invoking CMake commands.
Here we are calling the CMake command execute_process
to run (COMMAND
argument) the whoami
Linux command and saving the result (OUTPUT_VARIABLE
argument) into the _user_name
local variable.
# Get username
execute_process(
COMMAND
whoami
TIMEOUT
1
OUTPUT_VARIABLE
_user_name
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Thanks! Missed it, actually!
Dear Sir,
thanks a lot for your book. Awesome material. In chapter 6, recipe 2 you use built-in variables that I can find nowhere in the official documentation. Searching Google for "cmake '_user_name'" delivers 51 results only. How did you find out about these variables?
Kind regards!