vcpkg/ports/gtest/portfile.cmake
مهدي شينون (Mehdi Chinoune) b718abc739
[gtest] update to 1.14.0 (#33728)
2023-09-13 15:54:23 -07:00

63 lines
2.5 KiB
CMake

if (EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/googletest
REF "v${VERSION}"
SHA512 765c326ccc1b87a01027385e69238266e356361cd4ee3e18e3c9d137a5d11fa5d657c164d02dd1be8fe693c8e10f2b580588dbfa57d27f070e2750f50d3e662c
HEAD_REF main
PATCHES
001-fix-UWP-death-test.patch
clang-tidy-no-lint.patch
fix-main-lib-path.patch
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" GTEST_FORCE_SHARED_CRT)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DBUILD_GMOCK=ON
-Dgtest_force_shared_crt=${GTEST_FORCE_SHARED_CRT}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/GTest)
file(
INSTALL
"${SOURCE_PATH}/googletest/src/gtest.cc"
"${SOURCE_PATH}/googletest/src/gtest_main.cc"
"${SOURCE_PATH}/googletest/src/gtest-all.cc"
"${SOURCE_PATH}/googletest/src/gtest-assertion-result.cc"
"${SOURCE_PATH}/googletest/src/gtest-death-test.cc"
"${SOURCE_PATH}/googletest/src/gtest-filepath.cc"
"${SOURCE_PATH}/googletest/src/gtest-internal-inl.h"
"${SOURCE_PATH}/googletest/src/gtest-matchers.cc"
"${SOURCE_PATH}/googletest/src/gtest-port.cc"
"${SOURCE_PATH}/googletest/src/gtest-printers.cc"
"${SOURCE_PATH}/googletest/src/gtest-test-part.cc"
"${SOURCE_PATH}/googletest/src/gtest-typed-test.cc"
DESTINATION
${CURRENT_PACKAGES_DIR}/src
)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
vcpkg_fixup_pkgconfig()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gmock_main.pc" "libdir=\${prefix}/lib" "libdir=\${prefix}/lib/manual-link")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gtest_main.pc" "libdir=\${prefix}/lib" "libdir=\${prefix}/lib/manual-link")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gmock_main.pc" "libdir=\${prefix}/lib" "libdir=\${prefix}/lib/manual-link")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gtest_main.pc" "libdir=\${prefix}/lib" "libdir=\${prefix}/lib/manual-link")
endif()
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")