Skip to content

Commit c4c1e2e

Browse files
committed
cmake_uninstall - simplify by using common variable
1 parent dbb4e91 commit c4c1e2e

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

cmake/cmake_uninstall.cmake.in

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,24 @@ file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
2525
string(REGEX REPLACE "\n" ";" files "${files}")
2626

2727
foreach(file ${files})
28-
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
28+
set(filepath "$ENV{DESTDIR}${file}")
29+
message(STATUS "Uninstalling ${filepath}")
2930

30-
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
31+
if(IS_SYMLINK "${filepath}" OR EXISTS "${filepath}")
3132
exec_program(
3233
"@CMAKE_COMMAND@"
3334
ARGS
34-
"-E remove \"$ENV{DESTDIR}${file}\""
35+
"-E remove \"${filepath}\""
3536
OUTPUT_VARIABLE
3637
rm_out
3738
RETURN_VALUE
3839
rm_retval
3940
)
4041

4142
if(NOT "${rm_retval}" STREQUAL 0)
42-
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
43+
message(FATAL_ERROR "Problem when removing ${filepath}")
4344
endif()
44-
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
45-
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
45+
else(IS_SYMLINK "${filepath}" OR EXISTS "${filepath}")
46+
message(STATUS "File ${filepath} does not exist.")
4647
endif()
4748
endforeach()

0 commit comments

Comments
 (0)