[Beignet] [PATCH v2] build: use EXECUTE_PROCESS to replace the deprecated EXEC_PROGRAM.

Zhigang Gong zhigang.gong at intel.com
Mon May 18 23:15:21 PDT 2015


I found EXEC_PROMGRAM may truncate the output variable for some case
thus we may get incorrect generated unit test cases thus break the
configuration some times.

This patch use EXECUTE_PROCESS to replace all the deprecated EXEC_PROGRAM
and it will not truncate the output variable of the command.

v2:
fix the error in examples/CMakeLists.txt.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 examples/CMakeLists.txt | 12 ++++++------
 utests/CMakeLists.txt   |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 904f259..2c13eac 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,9 +1,9 @@
-EXEC_PROGRAM(ls ARGS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libva" OUTPUT_VARIABLE LS_OUTPUT)
-IF(NOT LS_OUTPUT)
-EXEC_PROGRAM(git "${CMAKE_CURRENT_SOURCE_DIR}/.." ARGS "submodule init")
-EXEC_PROGRAM(git "${CMAKE_CURRENT_SOURCE_DIR}/.." ARGS "submodule update")
-EXEC_PROGRAM(git "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libva" ARGS "checkout master")
-ENDIF(NOT LS_OUTPUT)
+EXECUTE_PROCESS(COMMAND ls "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libva" RESULT_VARIABLE LS_RESULT)
+IF (NOT ("LS_RESULT" STREQUAL "0"))
+EXECUTE_PROCESS(COMMAND git submodule init WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
+EXECUTE_PROCESS(COMMAND git submodule update WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
+EXECUTE_PROCESS(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libva)
+ENDIF (NOT ("LS_RESULT" STREQUAL "0"))
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
                     ${CMAKE_CURRENT_SOURCE_DIR}/../utests
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index d5bf14a..19e92c4 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -2,8 +2,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
                     ${CMAKE_CURRENT_SOURCE_DIR}/../include)
 
 ##### Math Function Part:
-EXEC_PROGRAM(mkdir ${CMAKE_CURRENT_SOURCE_DIR} ARGS generated -p)
-EXEC_PROGRAM(${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} ARGS utest_math_gen.py OUTPUT_VARIABLE GEN_MATH_STRING)
+EXECUTE_PROCESS(COMMAND mkdir generated -p WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} utest_math_gen.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GEN_MATH_STRING)
 string(REGEX REPLACE " " ";" ADDMATHFUNC ${GEN_MATH_STRING})
 
 string(REGEX REPLACE "generated/([^\ ]*)\\.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../kernels/\\1.cl" KERNEL_MATH_LIST ${GEN_MATH_STRING})
-- 
1.9.1



More information about the Beignet mailing list