From dc2317fa9131c72621ee1d0e0e3c9aa63ef29e0f Mon Sep 17 00:00:00 2001 From: Dan Nechita Date: Thu, 12 Dec 2024 15:18:57 +0200 Subject: [PATCH] cmake: Replace deprecated exec_program() with execute_process() Invoking the uninstall target causes warning messages about using deprecated exec_program() such as: "sudo make uninstall -- Uninstalling /usr/lib/x86_64-linux-gnu/pkgconfig/libiio.pc CMake Warning (dev) at cmake_uninstall.cmake:49 (exec_program): Policy CMP0153 is not set: The exec_program command should not be called. Run "cmake --help-policy CMP0153" for policy details. Use the cmake_policy command to set the policy and suppress this warning. " Used cmake version 3.28.3. Signed-off-by: Dan Nechita --- cmake/cmake_uninstall.cmake.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in index ca6864dac..386a0ff23 100644 --- a/cmake/cmake_uninstall.cmake.in +++ b/cmake/cmake_uninstall.cmake.in @@ -46,10 +46,10 @@ 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 rm $ENV{DESTDIR}${file} OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval + RESULT_VARIABLE rm_retval ) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") @@ -66,10 +66,10 @@ foreach(file ${files}) break() endif() message(STATUS "Removing empty directory: ${dir}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove_directory ${dir}" + execute_process( + COMMAND @CMAKE_COMMAND@ -E rm -rf ${dir} OUTPUT_VARIABLE stdout - RETURN_VALUE result + RESULT_VARIABLE result ) if(NOT "${result}" STREQUAL 0) message(FATAL_ERROR "Failed to remove directory: '${file}'.")