vcpkg/ports/gtest/portfile.cmake
مهدي شينون (Mehdi Chinoune) 23f346e780
[gtest] update to 1.12.0 (#25410)
2022-06-24 13:47:34 -07:00

60 lines
2.4 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 release-1.12.0
SHA512 6216e76a8c988b6b3739f3988c85f369eef2a8036c4412621a0d3d04ceeada00d35e487363be0a265035ac78f1a5065e1fe054a285c43df23b6abcc69f8bfe3d
HEAD_REF main
PATCHES
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)