Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I echo the command string executed by 'execute_process'?

Tags:

cmake

I have a CMake script that creates a command string and runs it with execute_process. But, some of the parameters are not getting filled in properly. Is there a way to print the actual command string that is getting executed?

There is a message call just above it which shows what the command should be but when I run that string on the command line, it works fine while the CMake execute_process fails.

like image 796
doobop Avatar asked Oct 24 '25 07:10

doobop


1 Answers

Starting from CMake 3.15, execute_process has a COMMAND_ECHO <where> parameter, and there is also the CMAKE_EXECUTE_PROCESS_COMMAND_ECHO variable to set a default behaviour:

COMMAND_ECHO <where>

New in version 3.15.

The command being run will be echo'ed to <where> with <where> being set to one of STDERR, STDOUT or NONE. See the CMAKE_EXECUTE_PROCESS_COMMAND_ECHO variable for a way to control the default behavior when this option is not present.

like image 120
starball Avatar answered Oct 26 '25 03:10

starball