Skip to content

CMake finder module that tries to locate Google C++ Mocking Framework (GMock) library and include files.

Notifications You must be signed in to change notification settings

triglav/cmake-findgmock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

FindGMock.cmake

Description

CMake finder module that tries to locate Google C++ Mocking Framework (GMock) library and include files.

(This file is almost an identical copy of the original FindGTest.cmake file, feel free to use it as it is or modify it for your own needs.)

Input Variables

Accepts the following variables as input:

  • GMOCK_ROOT - (as a CMake or environment variable) The root directory of the gmock install prefix
  • GMOCK_MSVC_SEARCH - If compiling with MSVC, this variable can be set to "MD" or "MT" to enable searching a gmock build tree (defaults: "MD")

Defined Variables

Defines the following variables:

  • GMOCK_FOUND - Found the Google Testing framework
  • GMOCK_INCLUDE_DIRS - Include directories

Also defines the library variables below as normal variables. These contain debug/optimized keywords when a debugging library is found.

  • GMOCK_BOTH_LIBRARIES - Both libgmock & libgmock-main
  • GMOCK_LIBRARIES - libgmock
  • GMOCK_MAIN_LIBRARIES - libgmock-main

Example Usage

find_package(GMock REQUIRED)
include_directories(${GMOCK_INCLUDE_DIRS})

add_executable(foo foo.cc)
target_link_libraries(foo ${GMOCK_BOTH_LIBRARIES})

Licence

FindGMock.cmake is released under the MIT licence:

Copyright (c) 2011 Matej Svec

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

CMake finder module that tries to locate Google C++ Mocking Framework (GMock) library and include files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published