Tested with CMake & Eclipse on Ubuntu 16.
- Create a folder for Eclipse
- Run CMake with
-G "Eclipse CDT4 - Unix Makefiles"
in the Eclipse folder & out of the source code folder - Open Eclipse, import the project via "General", select generated Eclipse project folder
- Code & run
To keep things simple, I provided a Makefile
and you can copy it to the same folder with CMakeLists.txt
and then run:
make eclipse
# To delete the generated eclipse folder:
make eclean
NOTE: Eclipse CDT4 needs special CMake flag so it could index C++11 headers with proper C-processor defines. Make sure you pass -DCMAKE_CXX_COMPILER_ARG1=-std=c++11
to CMake.
- https://cmake.org/Wiki/Eclipse_CDT4_Generator
- https://codeyarns.com/2014/01/15/how-to-create-eclipse-project-from-cmake-project/
- http://stackoverflow.com/questions/18358389/eclipse-indexer-proper-c11-syntax-highlighting-when-generating-projects-with-c
- https://cmake.org/cmake/help/v3.6/generator/Eclipse%20CDT4.html