Add a CMake option BUILD_TESTS to decide whether to build S2 unit tests#333
Add a CMake option BUILD_TESTS to decide whether to build S2 unit tests#333jmr merged 3 commits intogoogle:masterfrom
Conversation
|
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. |
8280ac1 to
96c11dc
Compare
|
Is the intention to not build the unit tests themselves or just not build the google test/google mock subdirectories? I think this would only do the latter. |
@smcallis Both of them will not be built. As the code shows in: |
CMakeLists.txt
Outdated
|
|
||
| message("GOOGLETEST_ROOT: ${GOOGLETEST_ROOT}") | ||
| if (GOOGLETEST_ROOT) | ||
| if (GOOGLETEST_ROOT AND BUILD_TESTS) |
There was a problem hiding this comment.
Depending on only GOOGLETEST_ROOT was a mistake.
How about something like
if (BUILD_TESTS)
if (NOT GOOGLETEST_ROOT)
message(FATAL_ERROR "BUILD_TESTS requires GOOGLETEST_ROOT")
endif()
message("GOOGLETEST_ROOT: ${GOOGLETEST_ROOT}")
...
?
|
Thanks! |
In the use case of using s2geometry as a thirdparty library of a project, it's not needed to build S2 unit tests, but it's possible to use test utilities in src/s2/s2testing.
In this case,
s2testinghas to be exported, but unit tests are not necessary to build.This patch adds an option
BUILD_TESTSto decide whether to build S2 unit tests.