Skip to content

Commit 7e3af39

Browse files
committed
Add uninstall target
1 parent b9b0da9 commit 7e3af39

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ include_directories("${PROJECT_SOURCE_DIR}")
1111
add_executable(gqrx-scanner ${PROJECT_SOURCE_DIR}/gqrx-scan.c ${PROJECT_SOURCE_DIR}/gqrx-prot.c)
1212
target_link_libraries(gqrx-scanner m)
1313
install (TARGETS gqrx-scanner DESTINATION bin)
14+
# uninstall target
15+
if(NOT TARGET uninstall)
16+
configure_file(
17+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
18+
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
19+
IMMEDIATE @ONLY)
20+
21+
add_custom_target(uninstall
22+
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
23+
endif()

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ make
118118
sudo make install
119119
```
120120

121+
## Uninstall
122+
```
123+
sudo make uninstall
124+
```
125+
126+
121127
## TODOs
122128
* set modulation in bookmark search
123129
* automatic audio recording on signal detection

cmake_uninstall.cmake.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
if(NOT EXISTS "install_manifest.txt")
2+
message(FATAL_ERROR "Cannot find install manifest: install_manifest.txt")
3+
endif(NOT EXISTS "install_manifest.txt")
4+
5+
file(READ "install_manifest.txt" files)
6+
string(REGEX REPLACE "\n" ";" files "${files}")
7+
foreach(file ${files})
8+
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9+
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10+
exec_program(
11+
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12+
OUTPUT_VARIABLE rm_out
13+
RETURN_VALUE rm_retval
14+
)
15+
if(NOT "${rm_retval}" STREQUAL 0)
16+
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17+
endif(NOT "${rm_retval}" STREQUAL 0)
18+
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
19+
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20+
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
21+
endforeach(file)
22+

0 commit comments

Comments
 (0)