← Back to team overview

kicad-developers team mailing list archive

Re: make uninstall: no rule?

 

Attached you find a patch (created with bzr send) which add CMake
rules to create a uninstall make rule.

I did it following the CMake wiki you linked and it should work if one
compile from the build directory (building all kicad).

You can test it running the following commands from the kicad source
tree root:
mkdir build
cd build
cmake ../
make
(using root) make install
(using root) make uninstall

 Probably a similar approach shuold be added to all various
subprograms so that one could uninstall eg pcbnew only. I'm sure on
how to proceed with this.

What do you think of the patch?


Thanks,

Fabio Varesano


On 10/07/2010 03:38 PM, Wayne Stambaugh wrote:
> On 10/7/2010 8:45 AM, Dick Hollenbeck wrote:
>> On 10/07/2010 01:47 AM, Fabio Varesano wrote:
>>> INSTALL.txt says:
>>>
>>> If you want to uninstall KiCad again type "make uninstall" from within
>>> the build directory.
>>>
>>>
>>> But if I do so I get:
>>>
>>> [root@gamma build]# make uninstall
>>> make: *** No rule to make target `uninstall'.  Stop.
>>>
>>>
>>> How can I unistall it? I'm unable to overwrite my existing install
>>> with a new one. (make install won't overwrite existing files)
>>>
>>> Thanks,
>>>
>>> Fabio Varesano
>>>   
>>
>> Google Cmake uninstall.
>>
>> There was some wiki page about supporting uninstall with the "install"
>> target.
> 
> Here is the link.
> 
> http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
> 
> There is also a quick hack for Unix users as well.  Although I would use that
> with some caution.
> 
> Wayne
> 
>>
>> If you can think up a patch that is an improvement, email it in.
>>
>> Dick
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: fvaresano@xxxxxxxx-20101008095620-kx5z12dvklct2xmv
# target_branch: bzr+ssh://bazaar.launchpad.net/%2Bbranch/kicad/
# testament_sha1: ca291cca34e8fd4cbec0ee20bb6855be7d9637f5
# timestamp: 2010-10-08 11:58:38 +0200
# base_revision_id: andrf@xxxxxxx-20101007090528-064ib2xu8axr1zt6
# 
# Begin patch
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2010-07-31 12:26:07 +0000
+++ CMakeLists.txt	2010-10-08 09:56:20 +0000
@@ -217,6 +217,18 @@
 
 
 #================================================
+# make uninstall rules
+#================================================
+CONFIGURE_FILE(
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+  IMMEDIATE @ONLY)
+
+ADD_CUSTOM_TARGET(uninstall
+  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+
+
+#================================================
 # Installation parameters
 #================================================
 install(FILES INSTALL.txt

=== added file 'cmake_uninstall.cmake.in'
--- cmake_uninstall.cmake.in	1970-01-01 00:00:00 +0000
+++ cmake_uninstall.cmake.in	2010-10-08 09:56:20 +0000
@@ -0,0 +1,21 @@
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+  MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+FOREACH(file ${files})
+  MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+  IF(EXISTS "$ENV{DESTDIR}${file}")
+    EXEC_PROGRAM(
+      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+      OUTPUT_VARIABLE rm_out
+      RETURN_VALUE rm_retval
+      )
+    IF(NOT "${rm_retval}" STREQUAL 0)
+      MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+    ENDIF(NOT "${rm_retval}" STREQUAL 0)
+  ELSE(EXISTS "$ENV{DESTDIR}${file}")
+    MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+  ENDIF(EXISTS "$ENV{DESTDIR}${file}")
+ENDFOREACH(file)

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWR4Q1CAAAqxfgFAQXuf//3/v
/2S//9/6YAZ8HwHSibA0pV2ABwylNBpoAGhoAA0BkNNAAAAAJQo0k8NNRtUZD1TE9qT1PTIRkZGa
maEyNAZpBwDCMJpiGAQDIAYRpkyYRgIaDTSEEYmgJ5R6IAGnqAGgBoHqDamgHAMIwmmIYBAMgBhG
mTJhGAhoJJATQCaaDQTSNMplPU9E9NoQBpqe0SG1PRDEAsNKWsIjNVYzXpxPCBdqWV9itaikTSZr
CKG6Vm0wNLioQLFRC3EYMKreRAihAOdFHKZMgbLjUZCTT4i28mWggkcw+Kkoc+wreYoW+VaMUVm4
LYI2yO5oelHqKV9A6VgUL7/bqTs4y+KBWoz3Z2IoejlLQHQMkIdW880/2jP0MHtksigwdog4R80w
gYkIBRJIbUY01YxS7rADV97lSDkMjzqYJ80nHIOgaRs9/HWzMMDfqx7iXdZ++blk24ZY/m5deY9L
tOz6LYZge0PXMK9VwdJuA+drh4x9OAofVmMgespsMulg2atpQ7Q8k0snOGDuA9o/X8yIlHucnMIZ
CbWPqGD3B6QZffEKMIdoniJhOpesuCp9LlbU5RlGHBggkL07zy99Wb4V22hIKqeh+Ff9AOPDAhtB
9fS+m8MHYfZt8lJM0sZlpqGM6FFF0dmgGm8St0DNxRw6Y8Nm+81ShiSwbzdgkQ7wLLSBS4DGBhSm
QeQFjEJLMDVE8N3OmwN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