vcpkg/ports/libmariadb/portfile.cmake
NancyLi1013 88e03109aa
[libmariadb] Fix build error with cmake 3.20.0 (#17113)
* [libmariadb] Fix build error with cmake 3.20.0

* Update versions

* Add vcpkg.json

* Update versions/l-/libmariadb.json
2021-04-07 12:25:49 -07:00

79 lines
2.4 KiB
CMake

if (EXISTS "${CURRENT_INSTALLED_DIR}/share/libmysql")
message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mariadb-corporation/mariadb-connector-c
REF 7d304d26c787a3f0430624db977b615aba56e4bb # v3.1.12
SHA512 16e74b2cbe401492ef294e2442a00ef1739089152a88d9263ca4d17b65260554b330630e9405813fd9089fa445d676e3b6aa91ac94128ad6b0a299e8b7edc1b3
HEAD_REF 3.1
PATCHES
arm64.patch
md.patch
disable-test-build.patch
fix-InstallPath.patch
fix-iconv.patch
export-cmake-targets.patch
fix-build-error-with-cmake3.20.patch #This can be removed in next release, which has been merged to upstream.
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
zlib WITH_EXTERNAL_ZLIB
iconv WITH_ICONV
)
if("openssl" IN_LIST FEATURES)
set(WITH_SSL OPENSSL)
else()
set(WITH_SSL OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
-DWITH_UNITTEST=OFF
-DWITH_CURL=OFF
-DWITH_SSL=${WITH_SSL}
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-libmariadb TARGET_PATH share/unofficial-libmariadb)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
# remove debug header
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
if(VCPKG_BUILD_TYPE STREQUAL "debug")
# move headers
file(RENAME
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/include)
endif()
# remove plugin folder
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/lib/mariadb
${CURRENT_PACKAGES_DIR}/debug/lib/mariadb)
# copy & remove header files
file(REMOVE
${CURRENT_PACKAGES_DIR}/include/mariadb/my_config.h.in
${CURRENT_PACKAGES_DIR}/include/mariadb/mysql_version.h.in
${CURRENT_PACKAGES_DIR}/include/mariadb/CMakeLists.txt
${CURRENT_PACKAGES_DIR}/include/mariadb/Makefile.am)
file(RENAME
${CURRENT_PACKAGES_DIR}/include/mariadb
${CURRENT_PACKAGES_DIR}/include/mysql)
# copy license file
file(INSTALL ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)