meekrosoft / fff

A testing micro framework for creating function test doubles
Other
761 stars 167 forks source link

gtest conflicting #76

Open nrbrook opened 5 years ago

nrbrook commented 5 years ago

Describe the bug Because gtest is embedded in the root of the respository under the gtest directory, if this repository is included in a unit testing CMakeLists.txt using include_directories, and googletest is also used in the same project then #include "gtest/gtest.h" could include either header. As the gtest.h in this project is very old, this causes problems.

To Reproduce Steps to reproduce the behavior:

  1. Create a unit testing project
  2. Include this repository directory
  3. Also add googletest
  4. From a unit test, include gtest/gtest.h
meekrosoft commented 5 years ago

Yes, I can see this could cause a problem. What do you suggest we do to solve this?

nrbrook commented 5 years ago

The simple solution would be just to rename the directory, perhaps to lib/gtest. In my projects I use CMake which can download googletest during configuration. Alternatively googletest could be added as a git submodule. As the googletest used here is quite old there may be compatibility issues when updating.

eaibmz commented 2 years ago

This is how i solved this in my CMake file:

FetchContent_Declare(fff
    GIT_REPOSITORY https://github.com/meekrosoft/fff.git
    GIT_TAG v1.1)
FetchContent_GetProperties(fff)
if(NOT fff_POPULATED)
    FetchContent_Populate(fff)
    file(REMOVE_RECURSE ${fff_SOURCE_DIR}/gtest)
endif()
ztnel commented 2 years ago

+1 to this