You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build(cmake): Change FetchContent name of gtest to googletest as gtest_SOURCE_DIR is used internally by googletest (facebookincubator#12430)
Summary:
Project name `gtest` is [used internally](https://github.com/google/googletest/blob/3fbe4db9a39291ae8d7a9c5f1d75896bb4c5a18f/googletest/CMakeLists.txt#L50) for `googletest/googletest` in googletest's source code
Currently Velox imports gtest by `FetchContent_Declare(gtest)`, which means `gtest_SOURCE_DIR` will overwrite the one defined by googletest itself from `googletest/googletest` to `googletest`.
This would lead to weird issues when using bundled googletest. For example in [velox4j](https://github.com/velox4j/velox4j) when importing velox's source code, the following error will be caused:
```
CMake Error: File /opt/velox4j/src/main/cpp/cmake-build-debug/_deps/gtest-src/cmake/Config.cmake.in does not exist.
CMake Error at /opt/cmake/share/cmake-3.29/Modules/CMakePackageConfigHelpers.cmake:482 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
cmake-build-debug/_deps/gtest-src/googletest/CMakeLists.txt:106 (configure_package_config_file)
```
The patch fixes the issue by simply changing `FetchContent_Declare(gtest` to `FetchContent_Declare(googletest` so there is no chance that the project names collide.
See also a similar issue: google/googletest#2457.
Pull Request resolved: facebookincubator#12430
Reviewed By: kKPulla
Differential Revision: D70038120
Pulled By: mbasmanova
fbshipit-source-id: d7f5a7441335ae30e01e0269cd4265a57dcb4df0
0 commit comments