kevingurney commented on a change in pull request #10614:
URL: https://github.com/apache/arrow/pull/10614#discussion_r660672641
##########
File path: matlab/CMakeLists.txt
##########
@@ -72,3 +89,28 @@ else()
set_target_properties(featherwritemex PROPERTIES LIBRARY_OUTPUT_DIRECTORY
$<1:${CMAKE_SOURCE_DIR}/src>)
endif()
+
+# ######################
+# GoogleTest Integration
+# ######################
+# If the user has specified a GTEST_ROOT value, use their pre-built GoogleTest
binaries.
+# Otherwise, download and build GoogleTest automatically.
+if(GTEST_ROOT)
+ find_package(GTest REQUIRED)
+else()
+ download_and_build_google_test()
Review comment:
Installing GoogleTest via a package manager can be convenient on certain
platforms (e.g. modern Linux distributions, macOS, etc.), but package managers
tend to be hit or miss in terms of the specific version of third party
libraries that are available. For example, if a user is developing on an older
version of Debian, installing GoogleTest via `apt` might not give them the
flexibility of installing a more recent version.
The `GTEST_ROOT` approach is particularly helpful for letting users decide
exactly how they want to integrate with GoogleTest (e.g. if they need to lock
down all of their 3rd party dependencies and only refer to local source trees,
without ever calling out to the Internet). On the other hand, it can be tedious
and error prone for new developers to properly configure/build GoogleTest from
source, so it's nice that the `build_dependency` macro will automatically fetch
and build GoogleTest for you, without the user having to worry if they just
want to get started with local development quickly.
Your point about supporting package managers is a good one, though. Our
current `CMakeLists.txt` won't automatically find GoogleTest binaries that
have been installed via a package manager (although, a user could still
explicitly specify `GTEST_ROOT` here). A nice improvement would be to support
automatic discovery of GoogleTest binaries installed via a package manager.
Then, only if GoogleTest isn't found in the standard system directories
(`/usr/include`, `/usr/lib`, etc.), we would fall back to downloading and
building GoogleTest from source.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]