mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[benchmark][cmake] Move runcmd from AddSwiftBench* => SwiftBenchmarkUtils.cmake.
A quick NFC cleanup that I saw. rdar://40541972
This commit is contained in:
@@ -2,24 +2,6 @@
|
||||
include(CMakeParseArguments)
|
||||
include(SwiftBenchmarkUtils)
|
||||
|
||||
# Run a shell command and assign output to a variable or fail with an error.
|
||||
# Example usage:
|
||||
# runcmd(COMMAND "xcode-select" "-p"
|
||||
# VARIABLE xcodepath
|
||||
# ERROR "Unable to find current Xcode path")
|
||||
function(runcmd)
|
||||
cmake_parse_arguments(RUNCMD "" "VARIABLE;ERROR" "COMMAND" ${ARGN})
|
||||
execute_process(
|
||||
COMMAND ${RUNCMD_COMMAND}
|
||||
OUTPUT_VARIABLE ${RUNCMD_VARIABLE}
|
||||
RESULT_VARIABLE result
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT "${result}" MATCHES "0")
|
||||
message(FATAL_ERROR "${RUNCMD_ERROR}")
|
||||
endif()
|
||||
set(${RUNCMD_VARIABLE} ${${RUNCMD_VARIABLE}} PARENT_SCOPE)
|
||||
endfunction(runcmd)
|
||||
|
||||
function (add_swift_benchmark_library objfile_out sibfile_out)
|
||||
cmake_parse_arguments(BENCHLIB "" "MODULE_PATH;SOURCE_DIR;OBJECT_DIR" "SOURCES;LIBRARY_FLAGS;DEPENDS" ${ARGN})
|
||||
|
||||
|
||||
@@ -43,3 +43,22 @@ function(translate_flag is_set flag_name var_name)
|
||||
set("${var_name}" "" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Run a shell command and assign output to a variable or fail with an error.
|
||||
# Example usage:
|
||||
# runcmd(COMMAND "xcode-select" "-p"
|
||||
# VARIABLE xcodepath
|
||||
# ERROR "Unable to find current Xcode path")
|
||||
function(runcmd)
|
||||
cmake_parse_arguments(RUNCMD "" "VARIABLE;ERROR" "COMMAND" ${ARGN})
|
||||
execute_process(
|
||||
COMMAND ${RUNCMD_COMMAND}
|
||||
OUTPUT_VARIABLE ${RUNCMD_VARIABLE}
|
||||
RESULT_VARIABLE result
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT "${result}" MATCHES "0")
|
||||
message(FATAL_ERROR "${RUNCMD_ERROR}")
|
||||
endif()
|
||||
set(${RUNCMD_VARIABLE} ${${RUNCMD_VARIABLE}} PARENT_SCOPE)
|
||||
endfunction(runcmd)
|
||||
|
||||
Reference in New Issue
Block a user