Commit b3e7df82 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Fix the linking of various tests against GMock

Summary: A define was needed to be able to link when built against a shared-library version of gmock and gtest.

Reviewed By: yfeldblum

Differential Revision: D5100409

fbshipit-source-id: 9a4c9df20f682a25edde642c451476b2d1e1ae22
parent 5d24ef44
# #
# Find libgmock # Find libgmock
# #
# LIBGMOCK_DEFINES - List of defines when using libgmock.
# LIBGMOCK_INCLUDE_DIR - where to find gmock/gmock.h, etc. # LIBGMOCK_INCLUDE_DIR - where to find gmock/gmock.h, etc.
# LIBGMOCK_LIBRARY - List of libraries when using libgmock. # LIBGMOCK_LIBRARY - List of libraries when using libgmock.
# LIBGMOCK_FOUND - True if libgmock found. # LIBGMOCK_FOUND - True if libgmock found.
...@@ -15,9 +16,14 @@ FIND_PATH(LIBGMOCK_INCLUDE_DIR gmock/gmock.h) ...@@ -15,9 +16,14 @@ FIND_PATH(LIBGMOCK_INCLUDE_DIR gmock/gmock.h)
FIND_LIBRARY(LIBGMOCK_LIBRARY gmock_main) FIND_LIBRARY(LIBGMOCK_LIBRARY gmock_main)
# There isn't currently an easy way to determine if a library was compiled as
# a shared library on Windows, so just assume we've been built against a shared
# build of gmock for now.
SET(LIBGMOCK_DEFINES "GTEST_LINKED_AS_SHARED_LIBRARY=1" CACHE STRING "")
# handle the QUIETLY and REQUIRED arguments and set LIBGMOCK_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set LIBGMOCK_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGMOCK DEFAULT_MSG LIBGMOCK_LIBRARY LIBGMOCK_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGMOCK DEFAULT_MSG LIBGMOCK_DEFINES LIBGMOCK_LIBRARY LIBGMOCK_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBGMOCK_LIBRARY LIBGMOCK_INCLUDE_DIR) MARK_AS_ADVANCED(LIBGMOCK_DEFINES LIBGMOCK_LIBRARY LIBGMOCK_INCLUDE_DIR)
...@@ -263,6 +263,10 @@ if (BUILD_TESTS) ...@@ -263,6 +263,10 @@ if (BUILD_TESTS)
${FOLLY_DIR}/io/async/test/UndelayedDestruction.h ${FOLLY_DIR}/io/async/test/UndelayedDestruction.h
${FOLLY_DIR}/io/async/test/Util.h ${FOLLY_DIR}/io/async/test/Util.h
) )
target_compile_definitions(folly_test_support
PUBLIC
${LIBGMOCK_DEFINES}
)
target_include_directories(folly_test_support target_include_directories(folly_test_support
PUBLIC PUBLIC
${LIBGMOCK_INCLUDE_DIR} ${LIBGMOCK_INCLUDE_DIR}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment