kou commented on a change in pull request #10614:
URL: https://github.com/apache/arrow/pull/10614#discussion_r660207256



##########
File path: matlab/CMakeLists.txt
##########
@@ -17,6 +17,23 @@
 
 cmake_minimum_required(VERSION 3.20)
 
+# This function uses the ThirdpartyToolchain CMake module
+# in cpp/cmake_modules to automatically download and build GoogleTest.
+function(download_and_build_google_test)
+  # The ExternalProject module is required for downloading and building 
external dependencies.
+  include(ExternalProject)
+  # The ThirdpartyToolchain module automatically builds xsimd by default,
+  # so we explicitly disable building of xsimd here.
+  set(ARROW_SIMD_LEVEL "NONE")
+  set(ARROW_RUNTIME_SIMD_LEVEL "NONE")
+  # The ThirdpartyToolchain module must know the location of the Arrow C++ 
libraries source code.
+  set(arrow_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../cpp)
+  # The ThirdpartyToolchain module uses ExternalProject to download GoogleTest.
+  include(ThirdpartyToolchain)

Review comment:
       `ThirdpartyToolchain isn't expected to be used by `include`.
   Could you use `find_package(GTest REQUIRED CONFIG)` instead?

##########
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:
       Do we need this functionality for MATLAB module?
   How about installing GoogleTest via package manager on system such as `apt`, 
`dnf`, `brew` and so on?




-- 
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]


Reply via email to