1

I have been looking for a good IDE for c++, and Eclipse CDT seems to be a good candidate. I develop(ed) my projects in CMake, which means I need to be able to generate an Eclipse project with CMake in order to use Eclipse. CMake has an configuration option for Eclipse, but it's old and incomplete.(My version 4.9 isn't supported anymore)

So I am wondering if there is another way to generate a Eclipse project using CMake, that is compatible with newer Eclipse versions. Does anyone know of one? The Eclipse project generator HAS to be separate, it can't be integrated into Eclipse itself, as I need the project source files to be in a different location than the build files.(For GIT)

Thanks!

1 Answer 1

2

I hope I understand you correctly, that you want to use the CMake to generate a "project file" that you can later use to work with the Eclipse CDT.

You can generate a "Unix Makefile" from CMake. The option appears in the drop down menu, when you click configure, if you start cmake with gui in Linux (by typing cmake-gui at the terminal).

And then create a new project in the Eclipse CDT IDE by using the "Makefile Project with Existing Code" option in the menu (File->New->Project->"Makefile Project with Existing Code").

In this way, you will be able to use the Eclipse CDT IDE with your project.

5
  • Unfortunately, that will only partially work. There are no build targets loaded, and I can't access the source because it's in a different location. Is there any other way?
    – user2083443
    Commented Nov 23, 2018 at 19:38
  • 1
    You do not need "build targets" per se. If you click from menu-bar -> "project" -> "build all", it will build your project. Depending on how you setup the Makefile using the CMake parameters, the build will be in a different location. That is not an issue. In fact, that is pretty standard. I setup all my projects like that, with builds outside the source. Commented Nov 23, 2018 at 22:25
  • The problem is that I need to be able to compile parts of my project separately, and be able to debug an executable(I have multiple) And the source problem persists, Eclipse won't allow me to access my source files if the makefiles are in a different location.
    – user2083443
    Commented Nov 24, 2018 at 14:07
  • 1
    1. Ok, for the first problem, probably there is no solution. One way that is possible at least in my case is, I import into eclipse then just a sub-project. So each folder has makefile and I can open just this folder in Eclipse and will not need to compile the whole project. 2. I am not sure, how and why your makefiles are in a different location to the source. 3. I understand you want to prevent checking in your makefile to the git repo, but for that you can simply add the makefile in .gitignore and thus not have to see or commit it to the git repo. Commented Nov 24, 2018 at 14:13
  • It is CMake reccommended practice to put all build files in a different directory, and Eclipse also start's spamming my project folder when i give it my makefile, I just don't want that. But I'll keep looking.
    – user2083443
    Commented Nov 24, 2018 at 14:15