Copying a KDevelop project to another directory
What is the best way to copy an existing KDevel开发者_StackOverflow社区op project folder to another directory, so that the new project contains all the correct directory settings and configuration and there is as little manual editing (and thus less room for error) as possible?
There is some information about someone being successful here about copying the project and then editing every reference to the old path, but this is exactly what I'm hoping to avoid.
In fact, the Kdevelop manual specifically recommends against doing this (see manual, chapter 8, "Project Hacking" [would post a link but I'm nerfed for now]).
This project is shared on an SCM and should have as little dependency on a particular user as possible.
Project-files are project-related and therefore contain a lot of absolute paths etc. Its mostly easier to just import the sources again as a new project.
I'm using CMake which means that I just need to reset build-paths and the install-prefix. Sometimes environment variables needs to be added but thats just copy+paste.
I just had the same problem. An answer to a related question brought me to the following approach:
One can keep (and put under version control) the file
<project name>.kdev4
in the top directory of the project. (At least in my case, it doesn't contain any absolute paths.)The hidden directory
.kdev4/
in the top directory of the project should be deleted after copying (and excluded from version control) whilekdevelop
has not loaded the project.The project can now easily be reopened by
kdevelop
usingProject
->Open / Import
. After pointingkdevelop
to the top directory of the project, the file<project name>.kdev4
is recognized and can be accepted.kdevelop
then asks for the missing options.
This solution should be clean and cause minimal overhead when continuing work on a project in another directory. In my case, when reopening a cmake project, I could simply accept the proposed defaults. The hidden directory .kdev4/
is recreated when closing kdevelop
.
精彩评论