From 777a64e34104480b24c5ea9e87e0baa1da3f0f5c Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 19 Jan 2024 09:42:38 -0600 Subject: [PATCH 1/2] Replace exec_program with execute_process (#402) Signed-off-by: Addisu Z. Taddese Co-authored-by: Steve Peters --- cmake/IgnCheckSSE.cmake | 4 ++-- cmake/cmake_uninstall.cmake.in | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/IgnCheckSSE.cmake b/cmake/IgnCheckSSE.cmake index dc5b498e..6e71e8c8 100644 --- a/cmake/IgnCheckSSE.cmake +++ b/cmake/IgnCheckSSE.cmake @@ -159,7 +159,7 @@ endif() IF (ARCH MATCHES "i386" OR ARCH MATCHES "x86_64") IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO) + EXECUTE_PROCESS(COMMAND cat -u /proc/cpuinfo OUTPUT_VARIABLE CPUINFO) STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO}) STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE) @@ -207,7 +207,7 @@ IF (ARCH MATCHES "i386" OR ARCH MATCHES "x86_64") ENDIF (SSE42_TRUE) ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") - EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE + EXECUTE_PROCESS(COMMAND /usr/sbin/sysctl -n machdep.cpu.features OUTPUT_VARIABLE CPUINFO) STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO}) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in index f767ae39..0d845b1e 100644 --- a/cmake/cmake_uninstall.cmake.in +++ b/cmake/cmake_uninstall.cmake.in @@ -7,15 +7,15 @@ string(REGEX REPLACE "\n" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling '$ENV{DESTDIR}${file}'") if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + execute_process(COMMAND + @CMAKE_COMMAND@ -E remove $ENV{DESTDIR}${file} OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval + RESULT_VARIABLE rm_retval ) - if(NOT "${rm_retval}" STREQUAL 0) + if(rm_retfal AND NOT rm_retval STREQUAL 0) message(FATAL_ERROR "Problem when removing '$ENV{DESTDIR}${file}'") - endif(NOT "${rm_retval}" STREQUAL 0) + endif() else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") message(STATUS "File '$ENV{DESTDIR}${file}' does not exist.") - endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + endif() endforeach(file) From fb831869b0dc06a1d937ac1e63f044f310111130 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 2 May 2024 22:45:15 -0500 Subject: [PATCH 2/2] Remove additional exec_program Signed-off-by: Addisu Z. Taddese --- cmake/IgnSetCompilerFlags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/IgnSetCompilerFlags.cmake b/cmake/IgnSetCompilerFlags.cmake index 0a6b5b58..acb72c2f 100644 --- a/cmake/IgnSetCompilerFlags.cmake +++ b/cmake/IgnSetCompilerFlags.cmake @@ -74,7 +74,7 @@ macro(ign_setup_unix) find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) if(CMAKE_UNAME) - exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) + execute_process(COMMAND ${CMAKE_UNAME} -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR OUTPUT_STRIP_TRAILING_WHITESPACE) set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)") if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")