Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (1) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (30) javascript (3) Linux (164) Mac (19) Machine Learning (1) mySQL (47) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (45) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Saturday 20 June 2020

Import C++ project into CLion from GitHub

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.html



In 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 the project as it was imported from gitHub

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.