0

I want to ask a question to have a Cmake uninstall or Cmake remove command. There were two different posts about this question at least 5 years ago. ( 1 2 ) Additionally, there was a source website that explains how Cmake remove can be done posted 2 years ago. However, I couldn't follow the way I think because of the update on the file names. Could you help me with uninstalling or removing software that is built by Cmake?

Edit: I couldn't try the approach that uses install_manifest.txt because I don't have that file. Instead, I have these files: build.ninja , CMakeCache.txt, cmake_install.cmake, CPackConfig.cmake.

  • 1
    "However, I couldn't follow the way I think because of the update on the file names." - I don't understand your problem. Do you have file `install_manifest.txt` in the build directory? If yes, then you should be able to apply any answer about uninstalling. If you don't have this file (and don't have a build directory), then CMake cannot help you in uninstalling things. – Tsyvarev Mar 31 '22 at 07:40
  • What is the difference of your question regarding the question you mentioned? Sounds like a duplicate to me. – usr1234567 Mar 31 '22 at 07:40
  • @Tsyvarev No I don't have a text file named 'install_manifest.txt' but there are other text files with similar names. I thought those might have similar functionality. – Ömer GÜZEL Mar 31 '22 at 08:05
  • "but there are other text files with similar names." - What exact other files "with similar names" do you have? Please, be **specific**. The file `install_manifest.txt` should be created after successful installation of the project. Have you performed such installation? – Tsyvarev Mar 31 '22 at 08:08
  • @usr1234567 Yes I have the same question. What should I do when the solution doesn't help me even if they are approved. Because a long time passed I post the same question. If I made a mistake about the rules of StackOverflow, sorry I didn't know. – Ömer GÜZEL Mar 31 '22 at 08:09
  • @Tsyvarev I used the command 'cmake --build .' Command to install LLVM. currently I have text files named build.ninja CMakeCache.txt cmake_install.cmake CPackConfig.cmake – Ömer GÜZEL Mar 31 '22 at 08:14
  • @ÖmerGÜZEL If you had more reputation, you could start a bounty to get a more modern answer. But as far as I know, nothing changed. You have to make a clear explanation, why your question is no duplicate and why it adds value to this side. – usr1234567 Mar 31 '22 at 08:19
  • `cmake --build .` performs **building**. For **installing** run `cmake --build --target install .`. – Tsyvarev Mar 31 '22 at 08:26
  • @usr1234567 'The answers are not solving the problem because the updated software ' is not enough? (I just thought it is because of the update, of course, it may not be. Specifically, how it can be done with Cmake 3.23.0) What should I do when the approved question doesn't help me? (next time I can use that way if you tell me.) – Ömer GÜZEL Mar 31 '22 at 08:29
  • @ÖmerGÜZEL: " 'The answers are not solving the problem because the updated software ' is not enough?" - No, this reason is not enough for post duplicates. You need to demonstrate (in the question post) that you have **tried specific approaches**, and they either do not work for you or not suitable for some other reasons. E.g. you could say "I have tried approach XXX, but it gives me `foo` instead of expected `bar`. Or "I have checked approach YYY, but it requires file `foo.txt` which I don't have". Simply saying that "I have tried everything but it doesn't work" is not enough. – Tsyvarev Mar 31 '22 at 10:35
  • @Tsyvarev Note that there's a shorter version for installing that does rely on the target name: `cmake --install .` – fabian Mar 31 '22 at 17:49
  • As for the question: Support for uninstall functionality doesn't seem to be provided, if you're installing from the build directory directly. It would be pretty hard to undo file creation done with `install(CODE)` Furthermore the files installed may change, if you modify the project. Moreover the `--prefix` option can result in installation to several directories and there could even be an overlap. If you want to provide a clean uninstall use `cpack` with a generator that generates a package for a package manager, e.g. `DEB`/`RPM` for linux targets and do the installation via that package. – fabian Mar 31 '22 at 17:49

0 Answers0