-
Notifications
You must be signed in to change notification settings - Fork 11
/
cmake_benchmark.cmake.in
27 lines (24 loc) · 1.05 KB
/
cmake_benchmark.cmake.in
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
if(POLICY CMP0007)
cmake_policy(SET CMP0007 OLD)
endif(POLICY CMP0007)
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/benchmarks")
message(FATAL_ERROR "Cannot find benchmarks: \"@CMAKE_CURRENT_BINARY_DIR@/benchmarks\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/benchmarks")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/benchmarks" paths)
string(REGEX REPLACE "\n" ";" paths "${paths}")
foreach (path ${paths})
string(REGEX MATCH \\[.*\\] filename ${path})
message(STATUS "Running benchmark ${filename}")
string(REGEX REPLACE \\[.*\\] "" path "${path}")
string(REGEX REPLACE \\[ "" filename "${filename}")
string(REGEX REPLACE \\] "" filename "${filename}")
set(file ${path}/${BUILD}/${filename})
if (EXISTS "${file}")
execute_process( COMMAND "${file}" )
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Error running \"${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "${file}")
message(STATUS "Benchmark \"${file}\" does not exist.")
endif (EXISTS "${file}")
endforeach(path)