vcpkg/ports/libodb-mysql/portfile.cmake
Jack·Boos·Yu 8ead9c2674
[many ports]switch to vcpkg-cmake / vckg-cmake-config part 3 (#29883)
* [many ports]switch to vcpkg-cmake / vckg-cmake-config part 3

* version

* typo

* version

* typo

* version

* Fix params

* version

* deprecated vcpkg_extract_source_archive_ex

* version

* fix arguments

* version

* Rename argument

* version

* Deprecate vcpkg_extract_source_archive_ex

* version

---------

Co-authored-by: jyu49 <yu_jack@apple.com>
2023-03-07 14:14:52 -08:00

45 lines
1.5 KiB
CMake

vcpkg_download_distfile(ARCHIVE
URLS "https://www.codesynthesis.com/download/odb/2.4/libodb-mysql-2.4.0.tar.gz"
FILENAME "libodb-mysql-2.4.0.tar.gz"
SHA512 c27b73c3f61dccdd149c11c122185f645a00d5bc346b366ee65b738f8719c39d03fad07a0d55b62b3db9e3ad2507679c24ddda331e5d110f367ad32f7cf8b910
)
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
adapter_mysql_8.0.patch
fix-redefinttion.patch
)
file(REMOVE "${SOURCE_PATH}/version")
file(COPY
"${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt"
"${CMAKE_CURRENT_LIST_DIR}/config.unix.h.in"
DESTINATION "${SOURCE_PATH}")
set(MYSQL_INCLUDE_DIR "${CURRENT_INSTALLED_DIR}/include/mysql")
find_library(MYSQL_LIB NAMES libmysql mysqlclient PATH_SUFFIXES lib PATHS "${CURRENT_INSTALLED_DIR}" NO_DEFAULT_PATH REQUIRED)
find_library(MYSQL_LIB_DEBUG NAMES libmysql mysqlclient PATH_SUFFIXES lib PATHS "${CURRENT_INSTALLED_DIR}/debug" NO_DEFAULT_PATH)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DMYSQL_INCLUDE_DIR=${MYSQL_INCLUDE_DIR}
OPTIONS_RELEASE
-DMYSQL_LIB=${MYSQL_LIB}
OPTIONS_DEBUG
-DLIBODB_INSTALL_HEADERS=OFF
-DMYSQL_LIB=${MYSQL_LIB_DEBUG}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH share/odb PACKAGE_NAME odb)
vcpkg_copy_pdbs()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)