[poco] build with MySQL support (#2088)

* [poco] build with MySQL support

Set proper variables to enable MySQL support if libmysql port is installed

* [poco] Move Mysql support to a feature. Enable CMake config files.
This commit is contained in:
James Chang 2017-11-01 16:27:12 +08:00 committed by Robert Schumacher
parent 516c42bdc4
commit 4ff90ec430
3 changed files with 21 additions and 7 deletions

View File

@ -1,4 +1,8 @@
Source: poco
Version: 1.7.8-1
Version: 1.7.8-2
Build-Depends: zlib, pcre, sqlite3, expat
Description: Modern, powerful open source C++ class libraries for building network and internet-based applications that run on desktop, server, mobile and embedded systems.
Feature: mysql
Build-Depends: libmysql
Description: Mysql support for POCO

View File

@ -16,10 +16,13 @@ vcpkg_apply_patches(
${CMAKE_CURRENT_LIST_DIR}/foundation-public-include-pcre.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(POCO_STATIC ON)
else()
set(POCO_STATIC OFF)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" POCO_STATIC)
if("mysql" IN_LIST FEATURES)
# enabling MySQL support
set(MYSQL_INCLUDE_DIR "${CURRENT_INSTALLED_DIR}/include/mysql")
set(MYSQL_LIB "${CURRENT_INSTALLED_DIR}/lib/libmysql.lib")
set(MYSQL_LIB_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib/libmysql.lib")
endif()
vcpkg_configure_cmake(
@ -30,6 +33,11 @@ vcpkg_configure_cmake(
-DENABLE_SEVENZIP=ON
-DENABLE_TESTS=OFF
-DPOCO_UNBUNDLED=ON # OFF means: using internal copy of sqlite, libz, pcre, expat, ...
-DMYSQL_INCLUDE_DIR=${MYSQL_INCLUDE_DIR}
OPTIONS_RELEASE
-DMYSQL_LIB=${MYSQL_LIB}
OPTIONS_DEBUG
-DMYSQL_LIB=${MYSQL_LIB_DEBUG}
)
vcpkg_install_cmake()
@ -53,8 +61,7 @@ else()
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/poco)
# copy license
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/poco)

View File

@ -116,6 +116,9 @@ function(vcpkg_fixup_cmake_targets)
"get_filename_component\\(_IMPORT_PREFIX \"\\\${CMAKE_CURRENT_LIST_FILE}\" PATH\\)(\nget_filename_component\\(_IMPORT_PREFIX \"\\\${_IMPORT_PREFIX}\" PATH\\))*"
"get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)"
_contents "${_contents}")
string(REPLACE "${CURRENT_INSTALLED_DIR}" "_INVALID_ROOT_" _contents "${_contents}")
string(REGEX REPLACE ";_INVALID_ROOT_/[^\";]*" "" _contents "${_contents}")
string(REGEX REPLACE "_INVALID_ROOT_/[^\";]*;" "" _contents "${_contents}")
file(WRITE ${MAIN_TARGET} "${_contents}")
endforeach()