File: multi_exec_test.cmake

package info (click to toggle)
pocl 6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,320 kB
  • sloc: lisp: 149,513; ansic: 103,778; cpp: 54,947; python: 1,513; sh: 949; ruby: 255; pascal: 226; tcl: 180; makefile: 175; java: 72; xml: 49
file content (38 lines) | stat: -rw-r--r-- 774 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
macro(execute_command_with_args CMD_WITH_ARGS)

    string(REPLACE "####" ";" CMD_SEPARATED "${CMD_WITH_ARGS}")

    execute_process(COMMAND ${CMD_SEPARATED}
      RESULT_VARIABLE CMD_RESULT
      OUTPUT_VARIABLE stdout
      ERROR_VARIABLE  stderr
    )

    if( CMD_RESULT )
      message( SEND_ERROR "FAIL: Command exited with nonzero code (${CMD_RESULT}): ${CMD}\nSTDOUT:\n${stdout}\nSTDERR:\n${stderr}" )
    else()
      message("${stdout}")
      message("${stderr}")
    endif()

endmacro()

if(CMD1)
  execute_command_with_args(${CMD1})
endif()

if(CMD2)
  execute_command_with_args(${CMD2})
endif()

if(CMD3)
  execute_command_with_args(${CMD3})
endif()

if(CMD4)
  execute_command_with_args(${CMD4})
endif()

if(CMD5)
  execute_command_with_args(${CMD5})
endif()