I know you can enable proper syntax highlighting with the GXX_EXPERIMENTAL hack described here: Eclipse CDT indexer does not know C++11 containers
But i think, when gene
As already mentioned, the invocation of the project generators runs before the parsing of the CMakeLists.txt
.
Thus, any definitions inside of CMakeLists.txt
don't have any effect on the generated project files.
In case of eclipse-project generation, the capabilities of the compiler are requested inside CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake.
In line 23 the variable CMAKE_CXX_FLAGS
is parsed which is evaluated in line 30.
Especially this CMAKE_CXX_FLAGS
variable can only be set while invoking cmake
from command line.
Recommodation of proper cmake invokation: cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_CXX_FLAGS="-std=c++11"
(or replace c++11
with eg. c++14
or any other standard you like)
Hint:
The result from evaluating line 30 can be seen from running the following command as an example: touch /tmp/dummy; /usr/bin/c++ -v -E -x c++ -std=c++11 -dD /tmp/dummy
. It outputs all the defines from the compiler which are parsed into the eclipse-project:
...
#define __STDC__ 1
#define __cplusplus 201103L
...