[cppmicroservices] Fix find dependency gtest (#9886)

* [cppmicroservices] Fix find dependency gtest

* update baseline
This commit is contained in:
Jack·Boos·Yu 2020-02-05 06:46:24 +08:00 committed by GitHub
parent d4c6627acd
commit d09f4faf52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 9 deletions

View File

@ -1,5 +1,5 @@
Source: cppmicroservices
Version: v3.4.0
Version: 3.4.0-1
Homepage: https://github.com/CppMicroServices/CppMicroServices
Description: An OSGi-like C++ dynamic module system and service registry
Build-Depends: gtest

View File

@ -0,0 +1,24 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 136edff..9d29522 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -288,6 +288,10 @@ if(US_COMPILER_APPLE_CLANG OR US_COMPILER_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
+# Dependency
+find_package(GTest CONFIG REQUIRED)
+link_libraries(GTest::gtest GTest::gmock)
+
#-----------------------------------------------------------------------------
# Testing configuration
#-----------------------------------------------------------------------------
@@ -338,7 +342,7 @@ if(US_BUILD_TESTING)
endif()
if(US_USE_SYSTEM_GTEST)
- find_package(GTest REQUIRED)
+ find_package(GTest CONFIG REQUIRED)
else()
# This keeps GTest CMake variables hidden from users unless they explicitly want to view/modify them.
us_cache_var(BUILD_GMOCK ON BOOL "Build GMock" ADVANCED FORCE)

View File

@ -4,7 +4,9 @@ vcpkg_from_github(
REF b4d3d404df01d67dfd7fc36111bc5de50e1b89d6 # v3.4.0
SHA512 b4a55f7c86cae25e936a237108b82824458b123fa1c14d4e0218c72c444a6d7f0db8900409af321225ec818f5691894b01fd311c606463386e7ce8e81e3656c8
HEAD_REF development
PATCHES werror.patch
PATCHES
werror.patch
fix-dependency-gtest.patch
)
vcpkg_configure_cmake(
@ -13,21 +15,22 @@ vcpkg_configure_cmake(
OPTIONS
-DTOOLS_INSTALL_DIR:STRING=tools/cppmicroservices
-DAUXILIARY_INSTALL_DIR:STRING=share/cppmicroservices
-DUS_USE_SYSTEM_GTEST=TRUE
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cppmicroservices RENAME copyright)
vcpkg_fixup_cmake_targets()
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
# CppMicroServices uses a custom resource compiler to compile resources
# the zipped resources are then appended to the target which cause the linker to crash
# when compiling a static library
if(NOT BUILD_SHARED_LIBS)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
endif()
endif()

View File

@ -282,8 +282,6 @@ cppfs:x64-uwp=fail
cppgraphqlgen:arm-uwp=fail
cppgraphqlgen:x64-uwp=ignore
cppkafka:x64-linux=ignore
cppmicroservices:x86-windows=fail
cppmicroservices:x64-windows=fail
cppmicroservices:arm64-windows=fail
cppmicroservices:arm-uwp=fail
cppmicroservices:x64-uwp=fail