pineapple/externals/vcpkg/ports/gtest/portfile.cmake
2022-07-23 03:01:36 +02:00

59 lines
2.4 KiB
CMake
Executable file

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.11.0
SHA512 6fcc7827e4c4d95e3ae643dd65e6c4fc0e3d04e1778b84f6e06e390410fe3d18026c131d828d949d2f20dde6327d30ecee24dcd3ef919e21c91e010d149f3a28
HEAD_REF main
PATCHES
clang-tidy-no-lint.patch
fix-main-lib-path.patch
remove-werror.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-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)