Use execute_process instead of exec_program in FindJsoncpp.cmake (#1875)

This commit is contained in:
An Tao 2023-12-08 17:33:06 +08:00 committed by GitHub
parent 358de6e66f
commit c35e62ccd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -44,12 +44,13 @@ if(Jsoncpp_FOUND)
message(FATAL_ERROR "Error: jsoncpp lib is too old.....stop")
endif()
if(NOT WIN32)
exec_program(
cat
ARGS
"${JSONCPP_INCLUDE_DIRS}/json/version.h |grep JSONCPP_VERSION_STRING|sed s'/.*define/define/'|awk '{printf $3}'|sed s'/\"//g'"
OUTPUT_VARIABLE
jsoncpp_ver)
execute_process(
COMMAND cat ${JSONCPP_INCLUDE_DIRS}/json/version.h
COMMAND grep JSONCPP_VERSION_STRING
COMMAND sed -e "s/.*define/define/"
COMMAND awk "{ printf \$3 }"
COMMAND sed -e "s/\"//g"
OUTPUT_VARIABLE jsoncpp_ver)
message(STATUS "jsoncpp verson:" ${jsoncpp_ver})
if(jsoncpp_ver LESS 1.7)
message(