I have a project that builds with CMake system, and I like to import it in Eclipse. However, when I generate eclipse project files with 'cmake -G "Eclipse CDT4 - Unix Makefiles"' there are no default include paths in Eclipse project(such as /usr/include' or the gcc path for standard headers).
How to fix that in most right way?
System: linux gcc 4.3.3 cmake 2.6.4 eclipse 3.5.1
You can parse the list of directories directly from the compiler, so you know you are getting the exact same set that CMake is using (assuming your CMake setup is using the same compiler). Then, split them into a list with separate_arguments, and add them with the
include_directories
command.They will then be included in the generated Eclipse project.
try
for my case was
I hope it helps
You have to go to the project properties (right button over the project), "C/C++ include paths and symbols" and add them here as "external include paths".
In your CMakeLists.txt try adding the following two lines:
The first line looks up the path for
stdio.h
, which is located in/usr/include
on my system. The second adds this folder to the CMake include path. The/dummy/../
part was added to trick CMake into adding the folder (it wouldn't otherwise), and will eventually get stripped off.This works for me with CMake 2.8.8 and Eclipse 3.7.2.