Skip to content

Commit

Permalink
cmake: use execute_process instead of exec_program
Browse files Browse the repository at this point in the history
exec_program is deprecated since cmake >= 3.0
  • Loading branch information
joergsteffens authored and BareosBot committed Jan 30, 2024
1 parent fbcd7f0 commit c2628a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
10 changes: 5 additions & 5 deletions cmake/BareosCheckChflags.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2020-2021 Bareos GmbH & Co. KG
# Copyright (C) 2020-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or modify it under
# the terms of version three of the GNU Affero General Public License as
Expand All @@ -24,10 +24,10 @@ if(CHFLAGS_PROG)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/chflags-test-file.txt"
"Just a testfile"
)
exec_program(
${CHFLAGS_PROG} ${CMAKE_CURRENT_BINARY_DIR}
ARGS "nosunlink chflags-test-file.txt"
RETURN_VALUE CHFLAGS_RETURN
execute_process(
COMMAND ${CHFLAGS_PROG} nosunlink chflags-test-file.txt
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE CHFLAGS_RETURN
)
if(CHFLAGS_RETURN EQUAL 0)
set(CHFLAGS_WORKS YES)
Expand Down
11 changes: 6 additions & 5 deletions cmake/BareosCheckXattr.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2020-2020 Bareos GmbH & Co. KG
# Copyright (C) 2020-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or modify it under
# the terms of version three of the GNU Affero General Public License as
Expand All @@ -25,10 +25,11 @@ if(SETFATTR_PROG AND GETFATTR_PROG)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/xattr-test-file.txt"
"Just a testfile"
)
exec_program(
${SETFATTR_PROG} ${CMAKE_CURRENT_BINARY_DIR}
ARGS "--name=user.cmake-check --value=xattr-value xattr-test-file.txt"
RETURN_VALUE SETFATTR_RETURN
execute_process(
COMMAND ${SETFATTR_PROG} --name=user.cmake-check --value=xattr-value
xattr-test-file.txt
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE SETFATTR_RETURN
)
if(SETFATTR_RETURN EQUAL 0)
set(SETFATTR_WORKS YES)
Expand Down
10 changes: 4 additions & 6 deletions cmake/uninstall.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2020-2020 Bareos GmbH & Co. KG
# Copyright (C) 2020-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -29,11 +29,9 @@ foreach(file ${files})
if(EXISTS ${file})
message(STATUS "Removing file: '${file}'")

exec_program(
${CMAKE_COMMAND} ARGS
"-E remove ${file}"
OUTPUT_VARIABLE stdout
RETURN_VALUE result
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove ${file} COMMAND_ECHO STDOUT
RESULT_VARIABLE result
)

if(NOT "${result}" STREQUAL 0)
Expand Down

0 comments on commit c2628a8

Please sign in to comment.