Corentin Chary <[email protected]> writes:
> Build a shared library by default, build a static library if
> BUILD_SHARED_LIBS is OFF.
>
> Note that on windows, static libraries *must not* be built with
> dllexport, and dllimport *must not* be present when you build
> anything against them. That means that a project using a static
> qjson on win32 will have to define QJSON_STATIC prior incluing
> qjon's headers. That's far from perfect, and one could probably
> tweak FindQJSON.cmake and add something like "QJSON_DEFINITIONS".
The patch looks nice to me.
> diff --git a/src/qjson_export.h b/src/qjson_export.h
> index 9a807b9..9154d23 100644
> --- a/src/qjson_export.h
> +++ b/src/qjson_export.h
> @@ -23,13 +23,18 @@
> #include <QtCore/qglobal.h>
>
> #ifndef QJSON_EXPORT
> -# if defined(QJSON_MAKEDLL)
> +# ifndef QJSON_STATIC
> +# if defined(QJSON_MAKEDLL)
> /* We are building this library */
> -# define QJSON_EXPORT Q_DECL_EXPORT
> -# else
> +# define QJSON_EXPORT Q_DECL_EXPORT
> +# else
> /* We are using this library */
> -# define QJSON_EXPORT Q_DECL_IMPORT
> +# define QJSON_EXPORT Q_DECL_IMPORT
> +# endif
> # endif
> #endif
> +#ifndef QJSON_EXPORT
> +# define QJSON_EXPORT
> +#endif
>
> #endif
Personally, I find the following logic easier to understand, but that's
just me:
#ifndef QJSON_EXPORT
# if defined(QJSON_STATIC)
# define QJSON_EXPORT
# else
# if defined(QJSON_MAKEDLL)
/* We are building this library */
# define QJSON_EXPORT Q_DECL_EXPORT
# else
# /* We are using this library */
# define QJSON_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
QJson-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qjson-devel