-
Notifications
You must be signed in to change notification settings - Fork 311
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
Add a CMake option BUILD_TESTS to decide whether to build S2 unit tests #333
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
@@ -432,7 +433,7 @@ install(TARGETS ${S2_TARGETS} | |||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") | |||
|
|||
message("GOOGLETEST_ROOT: ${GOOGLETEST_ROOT}") | |||
if (GOOGLETEST_ROOT) | |||
if (GOOGLETEST_ROOT AND BUILD_TESTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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}")
...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done.
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,
s2testing
has to be exported, but unit tests are not necessary to build.This patch adds an option
BUILD_TESTS
to decide whether to build S2 unit tests.