Importing a CMake project into Eclipse CDT
KDevelop is an awesome IDE with great CMake support.
As for Eclipse - run this:
cd <project_dir>
cmake -G "Eclipse CDT4 - Unix Makefiles" ./
This will produce Eclipse project for you.
Import cmake project from github in Eclipse
From their git repository, the readme has the following instruction:
mkdir build
cd build
cmake ..
make -j4
sudo make install
You need to run cmake first. It it will do what it needs to do and gives you a make file to run. You don't need eclipse to build and compile!
How to configure Eclipse CDT for cmake?
In Eclipse-CDT you do not create cmake projects but you import cmake projects.
This is what you should do:
Say the source of your CMake project named "Planner" is located in
D:/javaworkspace/src/Planner
Create a folder (the folders NEED to be parallel to each other):
D:/javaworkspace/build/Planner
Go to the folder
D:/javaworkspace/build/Planner
and run CMake using the Eclipse generator:cmake ../../src/Planner -G"Eclipse CDT4 - Unix Makefiles"
This will generate the make files for your Planner project.
To import this in Eclipse do the following:
File -> Import -> C/C++ -> Existing code as Makefile project
and select
D:/javaworkspace/build/Planner
(the build output folder with the make files) as the "Existing Code location"
However, looking at your paths it seems to me that you are working on Windows. In windows CMake can generate Visual Studio projects. If you want to use CMake I suggest first creating a "hello world" project using CMake (remember, Eclipse does not create CMake projects, you have to create a CMakeLists.txt file by hand)
How to set Eclipse for cmake project?
Using CMake you can generate a project for Eclipse and then open it in the IDE. CMake will be called automatically to regenerate project if you make some changes at that level.
How to add files to Eclipse CDT project with CMake?
The problem I had was I made an "in-source" build instead of an "out-of-source" build. Now it works fine, and it was actually lots of info on this on the Wiki but somehow I misunderstood it.
Creating Eclipse CDT using CMake on Windows
I ended up not using the GUI. Instead I used the VS x64 Native Tools Command Prompt then ran the cmake
command:
cmake -G "Eclipse CDT4 - NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 ../
Related Topics
Get Current Time in Hours and Minutes
How to Decrease the Size of Generated Binaries
How to Check Internet Access Using a Bash Script on Linux
Iproute2 Commands for Mpls Configuration
Lowering Linux Kernel Timer Frequency
Write-Through Ram Disk, or Massive Caching of File System
What's the Reason Docker Ubuntu Official Image Would Exit Immediately When You Run/Start It
In Sshd Configuration What Does "Maxstartups 10:30:60" Mean
Can Clang Compile Code with Gcc Compiled .A Libs
Symbolic Link to a Hook in Git
Ubuntu: Using Curl to Download an Image
Why Does Perf Stat Show "Stalled-Cycles-Backend" as <Not Supported>
On Linux - Set Maximum Open Files to Unlimited. Possible
What Is the Best Emacs Workspaces Plugin