[CMake] Generate Eclipse project with support for c++ 11
Alexander Neundorf
a.neundorf-work at gmx.net
Sun Dec 7 16:52:30 EST 2014
On Friday, December 05, 2014 09:58:17 Luca Gherardi wrote:
> Hi all,
>
> 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). 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.
>
> Any idea on how can I address this issue?
please enter a ticket at http://public.kitware.com/Bug/
You could try to set the environment variable CXX to "g++ -std=c++11" and see
whether that works (didn't try).
Thanks
Alex
More information about the CMake
mailing list