[CMake] Eclipse generator - basic macros

Benjamin Schindler bschindler at inf.ethz.ch
Tue Jul 14 11:40:23 EDT 2009


Miguel A. Figueroa-Villanueva wrote:
> On Mon, Jul 13, 2009 at 10:31 AM, Benjamin Schindler wrote:
>   
>> Hi
>>
>> I'm working on a project which builds both on linux and windows. I generated
>> an eclipse project out of it which works basically fine but it's not able to
>> recognize i.e. the __GNUC__ macro (and probably any other macro defined per
>> default on gcc) are not recognized by eclipse. That means that by using a
>> header like:
>>
>> #if defined(_MSC_VER) && (_MSC_VER >= 1300)
>> #ifdef FLOW_DLL_EXPORT
>> #define FLOW_DLL _declspec(dllexport)
>> #else
>> #define FLOW_DLL _declspec(dllimport)
>> #endif
>> #else
>> #ifdef __GNUC__
>> #define FLOW_DLL
>> #endif
>> #endif
>>
>> and then declaring a class like:
>>
>> class FLOW_DLL something { .... };
>> will fool eclipse's parser. When I remove the #ifdef __GNUC__, it works. Is
>> this an issue in the eclipse generator or in the eclipse parser?
>>     
>
> The eclipse generator is an external generator... meaning that it uses
> unix makefiles to compile in in linux with gcc. So, the project should
> build properly, does it? If you go to the build directory and type
> 'make', does it build correctly?
>
> The problem would still be present for the eclipse parser to support
> the IDE browsing features. For example, it wil gray out the area when
> it should not do so, etc. Is this what you mean by will fool the
> parser?
>
> --Miguel
>   
Hi

Well, you are right about the greyed out area which is in short what I 
ment (The project builds just fine). I would not mind this in any way, 
but the issue is that classes utilizing that FLOW_DLL macro will be 
marked with Syntax error (because that symbol is then not defined) and 
thus, code completion is not available at all for these classes hich is 
a big usability issue here

Thanks
Benjamin


More information about the CMake mailing list