diff --git a/CMakeLists.txt b/CMakeLists.txt index d86b68d..00871c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,9 @@ set(PROJECT_VERSION_MINOR 0) set(PROJECT_VERSION_PATCH 1) set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) +# Build a shared library by default +option(BUILD_SHARED_LIBS "Build QHttpEngine as a shared library" ON) + set(BIN_INSTALL_DIR bin CACHE STRING "Binary runtime installation directory relative to the install prefix") set(LIB_INSTALL_DIR lib CACHE STRING "Library installation directory relative to the install prefix") set(INCLUDE_INSTALL_DIR include CACHE STRING "Header installation directory relative to the install prefix") diff --git a/src/qhttpengine_export.h.in b/src/qhttpengine_export.h.in index 4e14041..81b3214 100644 --- a/src/qhttpengine_export.h.in +++ b/src/qhttpengine_export.h.in @@ -30,14 +30,16 @@ #define QHTTPENGINE_VERSION_PATCH @PROJECT_VERSION_PATCH@ #define QHTTPENGINE_VERSION "@PROJECT_VERSION@" -#if defined(QT_STATIC) -# define QHTTPENGINE_EXPORT -#else +#cmakedefine BUILD_SHARED_LIBS + +#if defined(BUILD_SHARED_LIBS) # if defined(QHTTPENGINE_LIBRARY) # define QHTTPENGINE_EXPORT Q_DECL_EXPORT # else # define QHTTPENGINE_EXPORT Q_DECL_IMPORT # endif +#else +# define QHTTPENGINE_EXPORT #endif #endif // QHTTPENGINE_QHTTPENGINE_H