Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtest conflicting #76

Open
nrbrook opened this issue Jun 18, 2019 · 4 comments
Open

gtest conflicting #76

nrbrook opened this issue Jun 18, 2019 · 4 comments

Comments

@nrbrook
Copy link

nrbrook commented Jun 18, 2019

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
Copy link
Owner

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

@nrbrook
Copy link
Author

nrbrook commented Jul 3, 2019

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
Copy link

eaibmz commented Sep 16, 2021

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
Copy link

ztnel commented Feb 5, 2022

+1 to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants