Skip to main content
The 2024 Developer Survey results are live! See the results
Added two things to note
Source Link
user149408
  • 5.8k
  • 4
  • 35
  • 80

Elaborating on arrowd's answer for Eclipse:

First, choose a directory for the CMake files. I prefer to keep my Eclipse workspaces in ~/workspaces and the source code in ~/src. Data which I need to build or test the project goes in subdirs of the project's workspace dir, so I suggest doing the same for CMake.

Assuming both your workspace and source folders are named someproject, do:

cd ~/workspaces/someproject
mkdir cmake
cd cmake
cmake -G "Eclipse CDT4 - Unix Makefiles" ~/src/someproject

Then, in your Eclipse workspace, do:

File > Import... > General > Existing Projects into Workspace

Check Select root directory and choose ~/workspaces/someproject/cmake. Make sure Copy projects into workspace is NOT checked.

Click Finish and you have a CMake project in your workspace.

Two things to note:

  • I used cmake for the workspace subdir, but you can use a name of your choice.
  • If you make any changes to your build configuration (such as editing Makefile.am), you will need to re-run the last command in order for Eclipse to pick up the changes.

Elaborating on arrowd's answer for Eclipse:

First, choose a directory for the CMake files. I prefer to keep my Eclipse workspaces in ~/workspaces and the source code in ~/src. Data which I need to build or test the project goes in subdirs of the project's workspace dir, so I suggest doing the same for CMake.

Assuming both your workspace and source folders are named someproject, do:

cd ~/workspaces/someproject
mkdir cmake
cd cmake
cmake -G "Eclipse CDT4 - Unix Makefiles" ~/src/someproject

Then, in your Eclipse workspace, do:

File > Import... > General > Existing Projects into Workspace

Check Select root directory and choose ~/workspaces/someproject/cmake. Make sure Copy projects into workspace is NOT checked.

Click Finish and you have a CMake project in your workspace.

Elaborating on arrowd's answer for Eclipse:

First, choose a directory for the CMake files. I prefer to keep my Eclipse workspaces in ~/workspaces and the source code in ~/src. Data which I need to build or test the project goes in subdirs of the project's workspace dir, so I suggest doing the same for CMake.

Assuming both your workspace and source folders are named someproject, do:

cd ~/workspaces/someproject
mkdir cmake
cd cmake
cmake -G "Eclipse CDT4 - Unix Makefiles" ~/src/someproject

Then, in your Eclipse workspace, do:

File > Import... > General > Existing Projects into Workspace

Check Select root directory and choose ~/workspaces/someproject/cmake. Make sure Copy projects into workspace is NOT checked.

Click Finish and you have a CMake project in your workspace.

Two things to note:

  • I used cmake for the workspace subdir, but you can use a name of your choice.
  • If you make any changes to your build configuration (such as editing Makefile.am), you will need to re-run the last command in order for Eclipse to pick up the changes.
Source Link
user149408
  • 5.8k
  • 4
  • 35
  • 80

Elaborating on arrowd's answer for Eclipse:

First, choose a directory for the CMake files. I prefer to keep my Eclipse workspaces in ~/workspaces and the source code in ~/src. Data which I need to build or test the project goes in subdirs of the project's workspace dir, so I suggest doing the same for CMake.

Assuming both your workspace and source folders are named someproject, do:

cd ~/workspaces/someproject
mkdir cmake
cd cmake
cmake -G "Eclipse CDT4 - Unix Makefiles" ~/src/someproject

Then, in your Eclipse workspace, do:

File > Import... > General > Existing Projects into Workspace

Check Select root directory and choose ~/workspaces/someproject/cmake. Make sure Copy projects into workspace is NOT checked.

Click Finish and you have a CMake project in your workspace.