How to change CDT builder to CMake in existing project? [message #1840903] |
Wed, 28 April 2021 14:18 |
Benjamin Martin Messages: 12 Registered: December 2019 |
Junior Member |
|
|
I have an existing Eclipse project that uses the GNU Make Builder to generate makefiles, and I would like to experiment with using CMake instead. I have a CMakeLists.txt file written which I can use to build my project from the shell, but I cannot seem to change my Eclipse project so it builds using this CMakeLists.txt file. I have seen guides which say that this can be configured by changing the Current Builder option in my Eclipse project settings, but I only see "GNU Make Builder", "CDT Internal Builder", and "Autotools Makefile Generator" as the available options. I checked my installed software in Eclipse, and I have v10.2 of the C/C++ CMake Build Support - Preview plugin installed.
Any suggestions on why I can't seem to switch my project builder to CMake?
[Updated on: Wed, 28 April 2021 14:22] Report message to a moderator
|
|
|
Re: How to change CDT builder to CMake in existing project? [message #1841013 is a reply to message #1840903] |
Fri, 30 April 2021 12:57 |
Jose Maldonado Messages: 6 Registered: March 2021 |
Junior Member |
|
|
Hi Benjamin,
If you have written your own CMakeLists.txt (that's the best way I think), you should go to the eclipse marketplace, (Help-> eclipse marketplace), and there find and install the CMake plugins. Restart the app and go to "file->Import->Existing code as Makefile Project". Now you can find CMake driven. Simply browse your project path.
Ending: right click on the root of the project path structure and CMake->Refresh (Or something like that). Build your project now
Greetings
Jose.
[Updated on: Fri, 30 April 2021 12:59] Report message to a moderator
|
|
|
Re: How to change CDT builder to CMake in existing project? [message #1841517 is a reply to message #1841013] |
Wed, 19 May 2021 19:04 |
Benjamin Martin Messages: 12 Registered: December 2019 |
Junior Member |
|
|
Quote:Hi Benjamin,
If you have written your own CMakeLists.txt (that's the best way I think), you should go to the eclipse marketplace, (Help-> eclipse marketplace), and there find and install the CMake plugins. Restart the app and go to "file->Import->Existing code as Makefile Project". Now you can find CMake driven. Simply browse your project path.
Ending: right click on the root of the project path structure and CMake->Refresh (Or something like that). Build your project now
Greetings
Jose.
Hello. Thank you for the information. I have the Eclipse CDT CMake plugin installed, but I unfortunately cannot get the project to function as you describe. I can import the directory, select my toolchain (Cross GCC), and see that the project was created. However, there is no CMake->Refresh option, and I cannot see CMake as a builder option. (GNU Make and Autotools are the only options.) I tried to configure CMake in the Window> Preferences, but it would not let me select Cross GCC as my toolchain. Is there a step that I missed?
|
|
|
|
|
|
Re: How to change CDT builder to CMake in existing project? [message #1842125 is a reply to message #1842092] |
Wed, 09 June 2021 16:56 |
Benjamin Martin Messages: 12 Registered: December 2019 |
Junior Member |
|
|
David Vavra wrote on Tue, 08 June 2021 23:20C/C++ CMake Build Support - Preview 10.2.0.202012191711 comes with CDT.
While technically a plugin, I tend to use "plugin" for later add-in code.
In any case, you didn't supply enough information in your initial posts to determine what you tried to use.
To be fair, I did list the plugin I was using (and the version) at the end of the first paragraph in my initial post...
David Vavra wrote on Tue, 08 June 2021 23:20I suppose theoretically you could convert to a CMake builder by adding the CMake Nature to the project.
but if you are converting build types, there may still be conflicting entries is the .project and .cproject files.
You may also need to remove existing natures.
The problem is that CMake handling by CDT is poorly documented.
The only real documentation seems to be the code.
Possibly the best thing to do is create a new project solely for CMake.
You could compare it to those using other build systems.
That might give you enough on what is needed to make conversion.
Alternately you could try the plugins from the Marketplace.
Thanks for the information here. I was hoping that there would be a solution that didn't require me to dig around in the Eclipse project files and manipulate things, but I will have a look and see if I can figure out an easy way to add the CMake nature manually. I may also look at plugins other than the CDT one.
Other than that, I was trying to avoid the need to create a new Eclipse project, but if CDT just does not support changing build systems then I may end up having to create a new CMake-based Eclipse project from scratch. It also looks like CMake is capable of generating Eclipse projects from a CMakeLists.txt file so that may be an option as well. It's definitely not an optimal solution given that I already have a fully configured Eclipse project that I have been using for a while and just want to change the build generation tool.
[Updated on: Wed, 09 June 2021 20:56] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03359 seconds