Skip to content

Commit 43f55df

Browse files
committed
Fix link type mismatch on Windows and build a shared library by default.
1 parent f70405e commit 43f55df

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ set(PROJECT_VERSION_MINOR 0)
1111
set(PROJECT_VERSION_PATCH 1)
1212
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
1313

14+
# Build a shared library by default
15+
option(BUILD_SHARED_LIBS "Build QHttpEngine as a shared library" ON)
16+
1417
set(BIN_INSTALL_DIR bin CACHE STRING "Binary runtime installation directory relative to the install prefix")
1518
set(LIB_INSTALL_DIR lib CACHE STRING "Library installation directory relative to the install prefix")
1619
set(INCLUDE_INSTALL_DIR include CACHE STRING "Header installation directory relative to the install prefix")

src/qhttpengine_export.h.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
#define QHTTPENGINE_VERSION_PATCH @PROJECT_VERSION_PATCH@
3131
#define QHTTPENGINE_VERSION "@PROJECT_VERSION@"
3232

33-
#if defined(QT_STATIC)
34-
# define QHTTPENGINE_EXPORT
35-
#else
33+
#cmakedefine BUILD_SHARED_LIBS
34+
35+
#if defined(BUILD_SHARED_LIBS)
3636
# if defined(QHTTPENGINE_LIBRARY)
3737
# define QHTTPENGINE_EXPORT Q_DECL_EXPORT
3838
# else
3939
# define QHTTPENGINE_EXPORT Q_DECL_IMPORT
4040
# endif
41+
#else
42+
# define QHTTPENGINE_EXPORT
4143
#endif
4244

4345
#endif // QHTTPENGINE_QHTTPENGINE_H

0 commit comments

Comments
 (0)