5 Commits

Author SHA1 Message Date
Nathan Osman
43f55df516 Fix link type mismatch on Windows and build a shared library by default. 2018-03-22 13:14:00 -07:00
Nathan Osman
f70405e4d6 Merge pull request #25 from tonytheodore/master
Re-enable static builds
2018-03-16 23:12:06 -07:00
Tony Theodore
4b2705fb32 Require Qt5Network in pkg-config file 2018-03-15 19:24:38 +11:00
Tony Theodore
b85aa4b246 Enable static builds
If unspecified, `add_library` uses the value from cmake's builtin `BUILD_SHARED_LIBS` (default true).
2018-03-15 18:47:38 +11:00
Tony Theodore
d05bdd3ec2 Use QT_STATIC to define QHTTPENGINE_EXPORT 2018-03-15 18:45:08 +11:00
4 changed files with 14 additions and 4 deletions

View File

@@ -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")

View File

@@ -39,7 +39,7 @@ if(WIN32)
set(SRC ${SRC} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
endif()
add_library(qhttpengine SHARED ${HEADERS} ${SRC})
add_library(qhttpengine ${HEADERS} ${SRC})
set_target_properties(qhttpengine PROPERTIES
CXX_STANDARD 11

View File

@@ -6,5 +6,6 @@ Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
URL: @PROJECT_URL@
Version: @PROJECT_VERSION@
Requires: Qt5Network
Cflags: -I${includedir}
Libs: -L${libdir} -lqhttpengine

View File

@@ -30,10 +30,16 @@
#define QHTTPENGINE_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define QHTTPENGINE_VERSION "@PROJECT_VERSION@"
#if defined(QHTTPENGINE_LIBRARY)
# define QHTTPENGINE_EXPORT Q_DECL_EXPORT
#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 Q_DECL_IMPORT
# define QHTTPENGINE_EXPORT
#endif
#endif // QHTTPENGINE_QHTTPENGINE_H