[CMake] Eclipse .cproject Preprocessor Macro Definitions
Martin Weber
fifteenknots505 at gmail.com
Sat May 30 07:28:10 EDT 2015
Am Donnerstag, 28. Mai 2015, 19:17:08 schrieb Ette, Anthony:
> To Whom It May Concern:
>
> I'm using Cmake 3.2.2, specifically the "Eclipse CDT4 - NMake Makefiles"
> generator. I am able to successfully run cmake and build from within
> Eclipse but there seem to be things missing from the .cproject file. For
> example, I've got a source routine with #ifdef _WIN32 and this chunk of
> code is greyed out (i.e. not perceived active) in the Eclipse editor and
> source outline views (see picture below). I find this surprising since the
> build succeeds (it's ultimately able to find the necessary windows headers)
> and /DWIN32 is defined in CMAKE_CXX_FLAGS.
This may be more related to CDt than to cmake, since cmake just generates the
makefiles and the Eclipse project files.
Your code is displayed as greyed out, since CDT does not know about the _WIN32
macro (but the build does know). You may manually add it in the project
settings, or enable the GCC build output parser plus the gcc builtin specs
detector to tell CDT about the macro.
The build output parser will find macros and include paths in the gcc command
lines and add them automatically. Of course, this will not work, if the cmake
generated build script passes the compiler options in a file:(
Advertising: Give the cmake4eclips plugin a try (which I am the author of)
Martin
--
Cd wrttn wtht vwls s mch trsr.
More information about the CMake
mailing list