View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013146CMakeCMakepublic2012-04-19 03:562012-09-03 16:01
ReporterChristoph Pramberger 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformLinuxOSUbuntuOS Version12.04
Product VersionCMake 2.8.7 
Target VersionFixed in Version 
Summary0013146: ADD_CUSTOM_COMMAND has no OUTPUT / RESULT Variable
DescriptionHello!

I want to run a command directly after the target is built. In the documentation I found the "add_custom_command" with the parm "POST_BUILD".

It works fine, but I have one problem with this command, I do not know if the command was executed correctly.

To get this information I would need a RESULT_VARIALBE like that one in "execute_process".

 add_custom_command(OUTPUT output1 [output2 ...]
                     COMMAND command1 [ARGS] [args1...]
                     [COMMAND command2 [ARGS] [args2...] ...]
                     [MAIN_DEPENDENCY depend]
                     [DEPENDS [depends...]]
                     [IMPLICIT_DEPENDS <lang1> depend1 ...]
                     [WORKING_DIRECTORY dir]
                     [COMMENT comment] [VERBATIM] [APPEND])

  execute_process(COMMAND <cmd1> [args1...]]
                  [COMMAND <cmd2> [args2...] [...]]
                  [WORKING_DIRECTORY <directory>]
                  [TIMEOUT <seconds>]
                  [RESULT_VARIABLE <variable>]
                  [OUTPUT_VARIABLE <variable>]
                  [ERROR_VARIABLE <variable>]
                  [INPUT_FILE <file>]
                  [OUTPUT_FILE <file>]
                  [ERROR_FILE <file>]
                  [OUTPUT_QUIET]
                  [ERROR_QUIET]
                  [OUTPUT_STRIP_TRAILING_WHITESPACE]
                  [ERROR_STRIP_TRAILING_WHITESPACE])

Is there any possibility to get this information, if not you can see this report as feature request.

Thank you very much
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0029226)
David Cole (manager)
2012-04-19 06:20

Not possible, because the custom command does not run until build time, after CMake is done running. (So there's no CMake variable in which to put the result.)

If the command fails, the build will fail.

If the build succeeded, then the command succeeded...
(0029231)
Brad King (manager)
2012-04-19 07:56

If you want to to complex operations in a custom command like running something, checking the result, and then deciding what else to do based on the result, then you can run a .cmake script at build time inside the custom command. Specify

  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/myscript.cmake

Then use execute_process or other commands inside the script.

The above is a suggestion to get you started, but the issue tracker is not a good place for such discussion. Please bring further questions to the mailing list:

 http://www.cmake.org/mailman/listinfo/cmake [^]
(0030857)
David Cole (manager)
2012-09-03 16:01

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-04-19 03:56 Christoph Pramberger New Issue
2012-04-19 06:20 David Cole Note Added: 0029226
2012-04-19 07:56 Brad King Note Added: 0029231
2012-04-19 07:56 Brad King Status new => resolved
2012-04-19 07:56 Brad King Resolution open => no change required
2012-04-19 07:56 Brad King Assigned To => Brad King
2012-04-19 07:56 Brad King Assigned To Brad King =>
2012-09-03 16:01 David Cole Note Added: 0030857
2012-09-03 16:01 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team