According to this, I have 3 options to use cmake in Eclipse CDT for C++. None of them works.
The first is because I use out-of-source builds and the limitations of the generator is so lame. Also, it uses a hardcoded Eclipse project template, so it is fragile like hell. The second is the poor man's version of cmake support. It does not add any value to Eclipse, really. The third one simply does not work. I can't make an existing cmake project. I can create a new one, but not opening an existing one. Also, the cmake properties in the project properties windows throw an exception and that's it. Does not even show up.
Is there any GOOD support in Eclipse for cmake? Or any other powerful IDE? Like adding the CmakeList.txt and the corresponding project is created? I am mainly interested in having the proper include paths and the global make targets based on the cmake files. And of course it would be nice to have syntax colored editing of cmake files, etc.
We successfully use both Eclipse CDT and Qt Creator with a large CMake based project.
For Eclipse, we usually use option two exactly as described. There is also a CMake Eclipse plug-in called CMake Editor for syntax highlighting and command completion.
Personally, I am using QtCreator. It has quite good CMake support and is very fast. You should initially configure your project with the CMake GUI (using the Make or NMake Generator) and then open your top-level CMakeLists.txt file in QtCreator and point it to your already configured binary directory.
Have you taken a look at Qt Creator? It might have the features you are looking for.
I use CMake GUI for generating CDT project or Unix makefiles and then import it via Eclipse.
Also I use KDevelop 4 because it simply opens CMake projects and tightly integrates CMake support.
Congratulations, CLion http://www.jetbrains.com/clion/ new C++ IDE with CMake well integrated. See its features https://www.youtube.com/watch?feature=player_embedded&v=MY_Z90Tj6is
I tried all three and have found option 2 to be the only useful one. Option 1, the cmake CDT generator, is useless. I cannot get option 3 to work either.
Yes, option 2 is the "poor man's version" insofar as you must follow a series of steps when setting up a new project, rather than pressing a single button. But I have had good success with it for many projects in the past year. Like you, I always do out of source builds.
Also, to get syntax coloring of CMake files, use the excellent CMakeEd plugin for eclipse. It's beautiful.
CDT has official CMake support plugin currently. You can find through Help->Install menu of Eclipse.
Related
Checking CLion help https://www.jetbrains.com/help/clion/2016.2/importing-existing-non-cmake-project.html I see how to import a non-CMake project into CLion.
And I'm also able to clone a project from GitHub https://www.jetbrains.com/help/clion/2016.2/cloning-a-repository-from-github.html
The project https://github.com/quickfix/quickfix uses ./bootstrap and ./configure to setup a makefile.
What I'd like to do is import that makefile into my CLion project and build and run from that. Is this possible?
While it is possible to "import a project" that's not CMake-based into your CLion project, CLion does not itself directly support using Makefiles as an origination point for a project yet. I know that this is something that has been wanted by many people, and as far as I know, the creators of CLion are at some point planning to integrate some support for this.
In the meantime, however, there is no handy way to do this directly. CMake is a build system configurator, in that it generates its own set of Makefiles to build everything, based on the things you write in your CMakeLists.txt file.
Your best bet, should you want to use the quickfix lib in a project of yours, is to learn the CMake process for building an external dependency, and then linking it to your project. A good blog post on such a thing can be found here. If you simply want to work on changes to it in CLion for your own convenience, but keep the original build files, you could just have CLion generate its own little CMakeLists.txt file for the purposes of importing and color-coding everything, and then set your debug config, etc to point to the binaries generated by running make in the command line.
Long story short, there's no easy way to do what you are talking about directly, but depending on your intended purpose, there are a couple of alternate paths to a similar end. Hope this helps!
Support for Makefiles has been added to CLion, however, the feature is (as of writing) still in early development.
This feature allows for a CLion project to be created by selecting File > Open from the main menu and then selecting the top level Makefile for the project.
More details of the feature can be found here: https://www.jetbrains.com/help/clion/makefiles-support.html
I have a C++ code base with a large number of projects. Usually I can use CMake to generate the required project files for QtCreator, XCode, Visual Studio, etc. Now I need to compile for Embarcadero, but it does not seem that CMake supports it.
Does CMake support Embarcadero? If not, is there maybe some set of projects that I could generate with CMake and then import into Embarcadero.
For a toy example it may work with the bcc and bcc32c, bcc64 is not supported at all.
Maybe the new "free" compiler will help to change that - the press release seems to imply this.
Personally, I would not put my hopes to high. So far, everything I have seen from the company Embarcadero was just a let down.
You can use CMake's "Borland Makefiles" generator and then use Embarcadero's clang based bcc32c to compile the project. Here's their blog post about it: https://community.embarcadero.com/blogs/entry/using-cmake-with-the-free-embarcadero-c-compiler
I didn't find a way to generate project files for their IDE yet, but I'm wondering if one could use one of the "Visual Studio" generators, then manually change the file extension (considering Embarcadero is using MSBuild). But that's just a wild guess.
According to the current CMake documentation on generators, no CMake does not produce Embarcadero project files. Instead, you could use one of the Makefile generators, and set your IDE to run cmake and make when you execute its "build" command.
Is there an easy way to use clion (e.g. debugging) in a c++ project using biicode as construction tool?
In fact, both systems work with cmake, but biicode generates CMakeLists.txt that clion doesn't seem to understand (the one located in blocks/ nor the temporary one in cmake/).
Right now I could only work by using biicode self-generated CMakeLists.txt for regular builds, and a hand-crafted CMakeLists.txt to compile within clion. However duplicating the description of the construction does not sound like a good idea.
I guess some elaborated dark scripting could be done (I am pretty new to cmake), but I'm just playing around and I don't think it is worthwhile to do it or ask for it.
Has anyone tried to use clion and biicode? Is clion fully supporting cmake yet? Is biicode using internal code that fully cmake-compliant tools won't understand? Am I missing some silly idea?
Currently it is not possible. Unfortunately both biicode and CLion use cmake and use different conventions about the project layout/structure, and at the moment they are simply incompatible.
The good news are that the people at CLion are helping a lot to figure out the best solution so hopefully this will be fixed soon.
EDIT 19-Feb-2015: Now biicode 2.4.1 and last CLion EAP are compatible. You can open an existing biicode project in CLion using these steps:
CLion->Open project, navigate to your biicode project/cmake/ folder and open it (where the CMakeLists.txt lives)
CLion->Change project root, select your main biicode project folder.
Then you should be able to build and run your targets.
It can be convenient to check in Settings->Build, Execution, Deployment->CMake, "Automatically reload CMake on editing".
And remember, if you change your project, add or remove files, main executables, add or remove dependencies, to run $ bii cpp:configure so the whole project is updated
Now biicode and CLion work fully with each other. Here's a guide from biicode docs to use CLion.
Biicode has been replaced by Conan.io, which is far easier to use with CLion.
I develop app with some elements of Qt. I use cmake as build system and Eclipse only as editor and debugger. Everything comiles fine (thanks to CMake), however I can't force IDE to complete my Qt code.
Many times someone asked about it and the solution was to add include path. I did it of course, but
#include <QtSql>
is different, because there is no such file in include dir. It probably would work if I include all necassary files by hand. Is there any way to make Eclipse understand that "QtSql" means all classes from this module?
Install qt4 eclipse integration package. You can find instructions here
As the webpage says, the module package should live inside eclipse/plugins, untar the package and start eclipse just one time from the command-line:
eclipse -clean
From your question, I assume that you already have set up other Qt modules like QtCore or QtGui in Eclipse, if not please see this posting: https://stackoverflow.com/a/12670991/1611055
To also use the QSql submodule (without the eclipse Qt Plugin which is, IMHO, not maintained anymore) you need to add the following settings in "Project Properties => C/C++ General => Paths and Symbols":
On the "Includes" tab, for the GNU C++ language, add the following include paths:
/usr/include/qt4/QtSql
On the "Symbols" tab, for the GNU C++ language, add the following symbols with a value of "1":
QT_SQL_LIB
With these settings, the Eclipse C++ indexer also knows the QtSql classes.
Is CMake difficult to use? I've been developing a library using Windows and MSVC++ . I tested my code in Linux and OSX by tediously making objects from each file and making a library out of this.
I have several Directories ex:
Agui
-> Widgets
->Button
->ListBox
-> Backends
-> Allegro
And what I'd like is, for example, if I'm on Windows, it auto generates an msvc project with all these directories and files included and ready to be compiled.
On Linux and OSX I'd like to be able to do something like
cmake
make
is this possible with CMake, and easy to do given my situation.
Thanks
Yes, that is exactly the reason CMake is made for. Huge projects like KDE use CMake.
And its easy to setup.
This is exactly what CMake was developed to do. CMake generates native build files and workspaces that can be used on your platform of choice. So on Unix this is normally Unix Makefiles, on Windows Visual Studio you can select your Visual Studio version to generate a solution that can be opened in the IDE, or use NMake Makefiles.
If you want to add a simple library, you just use the add_library function, giving it a library name and a list of source files. I would recommend taking a look at the CMake tutorial for a brief overview. There is also a book, Mastering CMake, along with many tutorial pages. You can ask the CMake command line for help too, 'cmake --help-command add_library' would show you the add_library documentation.
CMake will generate project files for a number of IDEs, but I find that automake+libtool tend to be easier to use. Here is an excellent tutorial: http://www.lrde.epita.fr/~adl/autotools.html
Don't be put off by the page count: most of it is step-by-step revealing of diagrams.