File tree Expand file tree Collapse file tree 2 files changed +19
-18
lines changed
Expand file tree Collapse file tree 2 files changed +19
-18
lines changed Original file line number Diff line number Diff line change 22include (CMakeParseArguments)
33include (SwiftBenchmarkUtils)
44
5- # Run a shell command and assign output to a variable or fail with an error.
6- # Example usage:
7- # runcmd(COMMAND "xcode-select" "-p"
8- # VARIABLE xcodepath
9- # ERROR "Unable to find current Xcode path")
10- function (runcmd)
11- cmake_parse_arguments (RUNCMD "" "VARIABLE;ERROR" "COMMAND" ${ARGN} )
12- execute_process (
13- COMMAND ${RUNCMD_COMMAND}
14- OUTPUT_VARIABLE ${RUNCMD_VARIABLE}
15- RESULT_VARIABLE result
16- ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
17- if (NOT "${result} " MATCHES "0" )
18- message (FATAL_ERROR "${RUNCMD_ERROR} " )
19- endif ()
20- set (${RUNCMD_VARIABLE} ${${RUNCMD_VARIABLE} } PARENT_SCOPE)
21- endfunction (runcmd)
22-
235function (add_swift_benchmark_library objfile_out sibfile_out)
246 cmake_parse_arguments (BENCHLIB "" "MODULE_PATH;SOURCE_DIR;OBJECT_DIR" "SOURCES;LIBRARY_FLAGS;DEPENDS" ${ARGN} )
257
Original file line number Diff line number Diff line change @@ -43,3 +43,22 @@ function(translate_flag is_set flag_name var_name)
4343 set ("${var_name} " "" PARENT_SCOPE)
4444 endif ()
4545endfunction ()
46+
47+
48+ # Run a shell command and assign output to a variable or fail with an error.
49+ # Example usage:
50+ # runcmd(COMMAND "xcode-select" "-p"
51+ # VARIABLE xcodepath
52+ # ERROR "Unable to find current Xcode path")
53+ function (runcmd)
54+ cmake_parse_arguments (RUNCMD "" "VARIABLE;ERROR" "COMMAND" ${ARGN} )
55+ execute_process (
56+ COMMAND ${RUNCMD_COMMAND}
57+ OUTPUT_VARIABLE ${RUNCMD_VARIABLE}
58+ RESULT_VARIABLE result
59+ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
60+ if (NOT "${result} " MATCHES "0" )
61+ message (FATAL_ERROR "${RUNCMD_ERROR} " )
62+ endif ()
63+ set (${RUNCMD_VARIABLE} ${${RUNCMD_VARIABLE} } PARENT_SCOPE)
64+ endfunction (runcmd)
You can’t perform that action at this time.
0 commit comments