[cmake-developers] [CMake 0015316]: Generation of Eclipse project does not provide support for c++ 11

Mantis Bug Tracker mantis at public.kitware.com
Thu Dec 18 08:46:34 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15316 
====================================================================== 
Reported By:                lucaghera
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15316
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-12-18 08:46 EST
Last Modified:              2014-12-18 08:46 EST
====================================================================== 
Summary:                    Generation of Eclipse project does not provide
support for c++ 11
Description: 
I’m writing a CMake file for a project that should be compiled both in Ubuntu
and OS X.
I want to use eclipse as IDE, gcc and C++ 11.

I read different threads that suggest how to enable C++ 11 in eclipse.
According to them I included these lines in my CMake:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")

if (${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4")
	set(CMAKE_CXX_COMPILER_ARG1 "-std=c++11" CACHE STRING "C++ version for eclipse"
FORCE)
	set(CMAKE_ECLIPSE_VERSION "4.3" CACHE STRING "Eclipse version" FORCE)
endif (${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4”)

However, eclipse still set a wrong value for the symbol __cplusplus (199711L
instead of 201103L I guess). In the generated file .cproject this should be the
line <pathentry kind="mac" name="__cplusplus" path="" value="199711L"/> (in my
case 265)
For this reason eclipse is not able to index C++ 11 features such as shared
pointer.
Therefore I get a syntax error also if the code compiles.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-12-18 08:46 lucaghera      New Issue                                    
======================================================================



More information about the cmake-developers mailing list