Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to change CDT builder to CMake in existing project?
How to change CDT builder to CMake in existing project? [message #1840903] Wed, 28 April 2021 14:18 Go to next message
Benjamin Martin is currently offline Benjamin MartinFriend
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 Go to previous messageGo to next message
Jose Maldonado is currently offline Jose MaldonadoFriend
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 Go to previous messageGo to next message
Benjamin Martin is currently offline Benjamin MartinFriend
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 #1841525 is a reply to message #1841517] Thu, 20 May 2021 06:24 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You didn't say which CMake plugin you installed.
There are two as far as I can tell:
https://marketplace.eclipse.org/content/cmake-eclipse-helper#group-details
https://marketplace.eclipse.org/content/cmake4eclipse

Regardless, plugins from the Eclipse marketplace are third party products.
This forum is for plain vanilla CDT.
You will get better answers at the product support page.
Not all projects have one though.
You could also try emailing the developer(s).

Re: How to change CDT builder to CMake in existing project? [message #1842087 is a reply to message #1841525] Tue, 08 June 2021 18:10 Go to previous messageGo to next message
Benjamin Martin is currently offline Benjamin MartinFriend
Messages: 12
Registered: December 2019
Junior Member
David Vavra wrote on Thu, 20 May 2021 02:24
You didn't say which CMake plugin you installed.
There are two as far as I can tell:

[...]

Regardless, plugins from the Eclipse marketplace are third party products.
This forum is for plain vanilla CDT.


I'm trying to use the plugin that is displayed as "C/C++ CMake Build Support - Preview 10.2.0.202012191711 org.eclipse.cdt.cmake.feature.group Eclipse CDT" in the Installed Software window. Is this not considered plain vanilla CDT?
Re: How to change CDT builder to CMake in existing project? [message #1842092 is a reply to message #1842087] Wed, 09 June 2021 03:20 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
C/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.

I 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.
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 Go to previous message
Benjamin Martin is currently offline Benjamin MartinFriend
Messages: 12
Registered: December 2019
Junior Member
David Vavra wrote on Tue, 08 June 2021 23:20
C/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:20
I 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

Previous Topic:Variable view handing floating point types differently than expected
Next Topic:Editor underlines string_view as error
Goto Forum:
  


Current Time: Fri Apr 26 23:19:21 GMT 2024

Powered by FUDForum. Page generated in 0.03359 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top