[CMake] Eclipse generator - basic macros

Michael Jackson mike.jackson at bluequartz.net
Tue Jul 14 11:50:46 EDT 2009


On Jul 14, 2009, at 11:40 AM, Benjamin Schindler wrote:

>>> #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



Not sure how dangerous this is _but_ when I have the same type of code  
for my windows code I don't explicitly define the __GNUC__ case  
because AFAIK MSVC is the only compiler that _I_ am using that needs  
this type of decoration. If this happens to be your case also then  
simply have the following:


#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#ifdef FLOW_DLL_EXPORT
#define FLOW_DLL _declspec(dllexport)
#else
#define FLOW_DLL _declspec(dllimport)
#endif
#else
#define FLOW_DLL
#endif

If there are specific compilers that NEED to have FLOW_DLL defined to  
something that mimics MSVC (Like newer versions of GCC if you want to)  
then I would add specific #if defined (SOME_COMPILER) for that  
compiler. Any of that make sense?

---
Mike Jackson                 www.bluequartz.net





More information about the CMake mailing list