doobop
doobop

Reputation: 4510

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

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.

Upvotes: 3

Views: 1121

Answers (1)

starball
starball

Reputation: 50375

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.

Upvotes: 2

Related Questions