I have a native CMake project, and I want to use the Eclipse IDE with it so that it makes my development easier by providing auto-complete and and other features. I can\'t seem
In short, only the CDT generator is currently a viable option. Why? Simply because Eclipse must obtain the preprocessor defines, include paths, and what files are included in the build from somewhere. Otherwise we would end up indexing everything, and badly, without the correct macros being defined. If you have boost in your repo, or a medium or large sized tree, indexing everything simply isn't going to work in the real world - not with speed and reliability of Eclipse's indexer anyway. Since most people probably want to use Ninja for builds these days (who wants to wait 30+ secs for a warm build just to see what is dirty?), that rules out the only way of importing this information via makefiles that is currently supported, unless you want to have to generate two separate build systems every time you configure, which would make automation a real pain (given that cmake re-runs itself when the lists change).
In Eclipse Photon there is a new option to import cmake projects directly. However, at this stage, I'd say it looks mostly useless for anything other than trivial projects, since there doesn't seem to be any way to import an already configured build directory, or anywhere to set variables and arguments that get passed to cmake. I don't yet know how this feature actually works, but it would seem that Eclipse must be parsing through the hierarchy of CMakeLists, following the logic to see what add_subdirectory() calls are made, and what preprocessor defines are set, which is seemingly an approach with no future, given that we have cmake server mode for exactly this, and it will no doubt require reimplementation of almost all of a cmake language parser in Eclipse to make this work.
So far, the only viable solution that seems to meet real world requirements appears to be to use the cmake CDT generator. It can get the above mentioned information directly from inside cmake, and write it into the .cproject file. As previously mentioned, it is not really maintained, and relies on an outdated template for the .cproject, which causes some issues.
My own minimal requirements for cmake support are:
I can't see how to do any of the above with anything except the CDT generator at present, and the only way to achieve a working and refined solution requires either some hacking at cmake's generator, or post processing of the generated .cproject to be selective about what gets indexed (ie. not all of CMAKE_SOURCE_DIRECTORY). This is a another hack (since cmake doesn't have any way to attach post-configure tasks into the configure step, we have to fork a process, and monitor the parent cmake for termination. It is a deliberate decision on behalf of the cmake developers apparently, and perhaps rightly so)
I'd certainly really appreciate information of any better approach. The state of cmake support in Eclipse is pretty dismal for a tool that is supposed to be for C++ development. The indexer (at least when it isn't plagued by its regular lockups that require restarting of Eclipse), is actually amongst the best around, and Eclipse is a very good environment for jumping around the code.