I will show you how to do that using the Eclipse CDT4 generator, which isn't different than using any other CMake generator. It works for in-source and out-of-source builds.
At first we need to run CMake, and set ”Where is the source code” and “Where to build the binaries”, but before thatyou have to be sure that you have a CMakeLists.txt file in the src directory . Your project name should be different from your executable name and different from your build folder name. Otherwise, Eclipse will NOT pick up your executable as you build them. Our second work is that to select the generator(the window cmake-gui appears when you click Generate), in our case – Eclipse.
For Eclipse is important that the build directory to another and not to be a subdirectory of the source directory.
In the next step you have to run Eclipse and import new project. File/Import/General/ Existing Projects into Workspace, Then just click Next.
Here you have to Select root directory, then check your projects, keep "Copy projects into workspace" unchecked and Finish import.
And now I will build project with targets benchmark and mged. At first – benchmark: Project/Make Target/Build..., then select target:benchmark(location bench) and click Build
Already built project:
Now in analog of benchmark we will make it with MGED and will run it. Let’s choose the target...
And the built project:
So let’s run it and choose mged from binaries and then click OK.
And finally we have started MGED: