Environment: MAC OS X 11 (should be the same with Linux)
eclipse version: Oxygen.3a Release (4.7.3a)
cmake version: 3.11
The method used by the author is through the plug-in cmake4eclipse which can be found at the following address
https://github.com/15knots/cmake4eclipse
There are also some installation methods above, which can be installed by means of help -> Install New Software. Click on Add, the name is optional, and the address is filled in https://raw.githubusercontent.com/15knots/cmake4eclipse/master/releng/comp-update/
Then wait for a while, select cmake4eclipse to install and restart. The usage method can be found in Help -> Help Contants ->CMAKE for CDT User Guide.
Here's how I created my own project.
New -> C/C++ project ->C++ Managed Build ->${Your project name} -> Click Advance Setting in the next step (as shown below). And select cmake builder in Tool chain editor.
Here I choose an empty project, starting from scratch. Then you can create your directory structure under this project. However, there was a problem on the mac. When I created CMakeLists.txt and the source file, an error occurred when I clicked build project, as follows:
Error: Program "cmake" not found in PATH
PATH=[/bin:/usr/bin:/usr/sbin:/sbin]
cmake command not found. So add a PATH variable through the eclipse configuration page:
After the compilation is passed, the compiled file will be output in the build.