MantisBT - CMake
View Issue Details
0013823CMakeCMakepublic2012-12-30 15:472013-02-10 13:54
SirHase 
Alex Neundorf 
normalminoralways
closedfixed 
LinuxGentoo x86_64
CMake 2.8.10.2 
 
0013823: Auto-include Clang default include paths in Eclipse CDT
When generating a new Eclipse CDT project using CMake with Clang compiler (/usr/bin/clang++), the project do not includes the default Clang include/preprocessors symbols list, as it does when I use gcc.

Without the preprocessor symbols and include paths, Eclipse reports a lot of false errors.

In Additional Information I talk about a solution, but may not be ideal because requires extra steps, and the user needs to manually include the projects compilation flags (-std=c++11 -stdlib=libc++).
1) Create the first example from: http://www.cmake.org/cmake/help/cmake_tutorial.html [^]

2) Generate a Eclipse CDT project, specify native compiler to /usr/bin/clang and /usr/bin/clang++ for C and C++ respectively

3) Import this new project in Eclipse

4) Check the include paths, it should be empty
Software used:
Eclise IDE Version: Juno Service Release 1. Build id: 20121004-1855
Eclise CDT Version: 8.1.1.201209170703
Clang: 3.1 (branches/release_31) x86_64-pc-linux-gnu
--
Adding the include paths manually may not work because Eclipse can "forget" it after a restart.
--
Using Eclipse automatic path/symbols list discovery solution:
Setting the discovery command to: "/usr/bin/clang++ -E -P -v -dD ${plugin_state_location}/${specs_file} -std=c++11 -stdlib=libc++"(here I use C++11, so each environment will have it different, cant use CMake flags) then in "C/C++ Project Paths" -> "Path Containers" add paths/symbols with this discovery. This way, Eclipse preserves both CMake and default Clang includes/symbols.
No tags attached.
Issue History
2012-12-30 15:47SirHaseNew Issue
2012-12-31 04:55Alex NeundorfAssigned To => Alex Neundorf
2012-12-31 04:55Alex NeundorfStatusnew => assigned
2013-02-10 13:54Alex NeundorfNote Added: 0032246
2013-02-10 13:54Alex NeundorfStatusassigned => closed
2013-02-10 13:54Alex NeundorfResolutionopen => fixed

Notes
(0032246)
Alex Neundorf   
2013-02-10 13:54   
I merged the EclipseDetectClangIncludeDirs into next.
This code was until now enabled for gcc and Intel, and now also for clang.

It seems to work for me.
Let me know if it doesn't for you.