Import C++ project into CLion from GitHub, where project has been created in another IDE.
See also https://blog.david14.com/2020/05/some-commonly-used-git-and-github-stuff.htmlIn this example, we have a project on GitHub created with RedHat Codeready Studio (Eclipse).
1) import the project;
2) Choose GitHub Project (assuming GitHub credentials have been configured).
Note, once imported, there is no way to run the project at the moment;
Also note the project structure, in this case, it includes files from the Eclipse environment;
Also note;
3) So, we need to Make a new CMake project from the source, there may be other ways to do this but this works for me;
4) Choose the source folder, in the above example, this would be the CPP_ClassExample folder and then ensure the src folder and all source files are checked..
This then create a CMakeLists.txt file amongst other files and also removes files not required from the previous IDE.
Also note, we now have the option to run;
5) Run the project and we will see the below appear;
This then allows us to add the new required files to our GitHub project.
Note, ensure the CMakeLists.txt file is included in version control, when committing expand Unversioned Files and check CMakeLists.txt
Obviously at this stage, if the added files are pushed to GitHub, then if the project is to be pulled in the original IDE, there may be some confusion but you can always ignore any of the new files when pulled in the other IDE. Continue reading to see examples of pulling changed files back into Eclipse.
The below is a before and after using the CPP_ClassExample project;
Image above is how the project looks after Step 3 above (Make a new CMake project from the source)
Once the project is in CLion, any changes made in another IDE or indeed another installation can simply be pulled in by choosing Update Project as follows:
*To pull any source changes made on GitHub to Eclipse;
I). Right Click on Project, in this case CPP_ClassExample and choose Merge
II). Select the Remote Tracking Branch and choose Merge.
III). The changed files should now be pulled from Github.
If any remote changed files are not pulled, then;
Right Click on Project, in this case CPP_ClassExample and choose Synchronize Workspace
then;
You should then be able to pull source changes by jumping back to the previous step*
No comments:
Post a Comment
Note: only a member of this blog may post a comment.