File system-gtest.patch of Package libaom
Index: libaom-3.11.0/test/test.cmake
===================================================================
--- libaom-3.11.0.orig/test/test.cmake
+++ libaom-3.11.0/test/test.cmake
@@ -14,6 +14,7 @@ endif() # AOM_TEST_TEST_CMAKE_
set(AOM_TEST_TEST_CMAKE_ 1)
include(ProcessorCount)
+find_package(PkgConfig REQUIRED)
include("${AOM_ROOT}/test/test_data_util.cmake")
@@ -411,27 +412,21 @@ if(ENABLE_TESTS)
set(CMAKE_MACOSX_RPATH 1)
endif()
- add_library(
- aom_gtest STATIC
- "${AOM_ROOT}/third_party/googletest/src/googletest/src/gtest-all.cc")
- set_property(TARGET aom_gtest PROPERTY FOLDER ${AOM_IDE_TEST_FOLDER})
- # There are -Wundef warnings in the gtest headers. Tell the compiler to treat
- # the gtest include directories as system include directories and suppress
- # compiler warnings in the gtest headers.
- target_include_directories(
- aom_gtest SYSTEM
- PUBLIC "${AOM_ROOT}/third_party/googletest/src/googletest/include"
- PRIVATE "${AOM_ROOT}/third_party/googletest/src/googletest")
-
- # The definition of GTEST_HAS_PTHREAD must be public, since it's checked by
- # interface headers, not just by the implementation.
- if(NOT (MSVC OR WIN32))
- if(CONFIG_MULTITHREAD AND CMAKE_USE_PTHREADS_INIT)
- target_compile_definitions(aom_gtest PUBLIC GTEST_HAS_PTHREAD=1)
- else()
- target_compile_definitions(aom_gtest PUBLIC GTEST_HAS_PTHREAD=0)
- endif()
- endif()
+ pkg_check_modules(gtest REQUIRED gtest)
+ add_library(aom_gtest INTERFACE)
+ target_link_libraries(aom_gtest INTERFACE ${gtest_LIBRARIES})
+ target_link_directories(aom_gtest INTERFACE ${gtest_LIBRARY_DIRS})
+ target_link_options(aom_gtest INTERFACE ${gtest_LDFLAGS_OTHER})
+ target_include_directories(aom_gtest INTERFACE ${gtest_INCLUDE_DIRS})
+ target_compile_options(aom_gtest INTERFACE ${gtest_CFLAGS_OTHER})
+
+ pkg_check_modules(gmock REQUIRED gmock)
+ add_library(aom_gmock INTERFACE)
+ target_link_libraries(aom_gmock INTERFACE ${gmock_LIBRARIES})
+ target_link_directories(aom_gmock INTERFACE ${gmock_LIBRARY_DIRS})
+ target_link_options(aom_gmock INTERFACE ${gmock_LDFLAGS_OTHER})
+ target_include_directories(aom_gmock INTERFACE ${gmock_INCLUDE_DIRS})
+ target_compile_options(aom_gmock INTERFACE ${gmock_CFLAGS_OTHER})
endif()
# Setup testdata download targets, test build targets, and test run targets. The