[CMake] EXEC_PROGRAM vs EXECUTE_PROCESS

Brad King brad.king at kitware.com
Fri Feb 10 10:16:28 EST 2006


Filipe Sousa wrote:
> Now that cmake has EXECUTE_PROCESS command, should we use this instead
> of EXEC_PROGRAM?

If you want.  It is much more powerful.  I'll add this to the documentation.

> I notice that both commands captures output in a different way:
[snip]
> EXECUTE_PROCESS does not remove the last \n (\r\n on Windows) like
> EXEC_PROGRAM. Is this the desired behavior for EXECUTE_PROCESS or do I
> have to
> 
> IF(WIN32)
>   STRING(REPLACE "\r\n" "" output2 "${output2}")
> ELSE(WIN32)
>   STRING(REPLACE "\n" "" output2 "${output2}")
> ENDIF(WIN32)

I'll update the command to provide an option for whether the newlines 
should be fixed.

-Brad


More information about the CMake mailing list