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

CMakeLists.txt: fix googletest related options #1152

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shr-project
Copy link

$ grep -Ri install_.*mock .
./CMakeLists.txt: set(install_gmock OFF)
./third_party/googletest/googlemock/CMakeLists.txt:install_project(gmock gmock_main) $ grep -Ri build_gmock .
./CMakeLists.txt: set(BUILD_GMOCK ON)
./third_party/googletest/googletest/README.md:cmake .. -DBUILD_GMOCK=OFF ./third_party/googletest/CMakeLists.txt:option(BUILD_GMOCK "Builds the googlemock subproject" ON) ./third_party/googletest/CMakeLists.txt:if(BUILD_GMOCK) $ grep -Ri install_gtest .
./CMakeLists.txt: set(INSTALL_GTEST OFF)
./third_party/googletest/googletest/cmake/internal_utils.cmake: if(INSTALL_GTEST) ./third_party/googletest/googletest/CMakeLists.txt:if (INSTALL_GTEST) ./third_party/googletest/CMakeLists.txt:option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)

* https://cmake.org/cmake/help/book/mastering-cmake/chapter/Writing%20CMakeLists%20Files.html
  says that CMake options are case-sensitive and I don't see lower-case version in
  currently used googletest submodules and gtest is indeed installed with leveldb

* install_gmock option I don't see at all, so I've kept it as is, INSTALL_GTEST, BUILD_GMOCK
  do exist as upper-case

$ grep -Ri install_.*mock .
./CMakeLists.txt:  set(install_gmock OFF)
./third_party/googletest/googlemock/CMakeLists.txt:install_project(gmock gmock_main)
$ grep -Ri build_gmock .
./CMakeLists.txt:  set(BUILD_GMOCK ON)
./third_party/googletest/googletest/README.md:cmake .. -DBUILD_GMOCK=OFF
./third_party/googletest/CMakeLists.txt:option(BUILD_GMOCK "Builds the googlemock subproject" ON)
./third_party/googletest/CMakeLists.txt:if(BUILD_GMOCK)
$ grep -Ri install_gtest .
./CMakeLists.txt:  set(INSTALL_GTEST OFF)
./third_party/googletest/googletest/cmake/internal_utils.cmake:  if(INSTALL_GTEST)
./third_party/googletest/googletest/CMakeLists.txt:if (INSTALL_GTEST)
./third_party/googletest/CMakeLists.txt:option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)

* also use CACHE and FORCE as sugested in:
  https://cmake.org/cmake/help/latest/command/set.html
  https://stackoverflow.com/questions/20239334/cmake-set-subdirectory-options
  for the value to correctly propagate into third_party/googletest subdirectory

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
@google-cla
Copy link

google-cla bot commented Oct 20, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Successfully merging this pull request may close these issues.

None yet

1 participant