[Cmake] import/exports for shared libraries

sylvain.prat sylvain.prat at laposte.net
Wed, 5 May 2004 11:32:43 +0200


Hi,

I was wondering how to properly set import/exports for dll/shared =
libraries in a cross-platform manner :

- I see a *library*_EXPORTS whi=
le compiling some shared libraries : there's nothing about this in the do=
cumentation. So, what is this flag ? Can I use it to set up the export di=
rective (I mean since which version of cmake it appears) ? I currently th=
ink  that *library*_EXPORTS  can help to set the dllexport/no-export flag=
 but how to set the import flag while using shared libraries in executabl=
es ?
- how to set the exports/imports directives ? I used to set these :=


#if (defined(_WIN32) || defined(__CYGWIN__))
#  if defined(MYLIB_MAK=
EDLL)
#    define MYLIB_EXPORT __declspec(dllexport)
//#  define MYLIB_=
EXTERN
#  elif defined(MYLIB_USEDLL)
#    define MYLIB_EXPORT __declspe=
c(dllimport)
//#  define MYLIB_EXTERN //extern
#  endif
#endif

#ifn=
def MYLIB_EXPORT
#  define MYLIB_EXPORT
#endif
//#ifndef MYLIB_EXTERN=0D
=
//#define MYLIB_EXTERN
//#endif

- how can i automaticaly tell cmake t=
o build my project with consistent link options ?

Thanks in advance=0D
=

Sylvain PRAT=0A=0AAcc=E9dez au courrier =E9lectronique de La Poste : ww=
w.laposte.net ; =0A3615 LAPOSTENET (0,34=80/mn) ; t=E9l : 08 92 68 13 50 =
(0,34=80/mn)=0A=0A