kou commented on a change in pull request #12004:
URL: https://github.com/apache/arrow/pull/12004#discussion_r774197873
##########
File path: matlab/CMakeLists.txt
##########
@@ -212,56 +233,113 @@ if(MATLAB_BUILD_TESTS)
# C++ libraries that are built from source.
build_arrow(BUILD_GTEST)
else()
+ # GTest is found, on Windows, IMPORTED_LOCATION needs to be set to
indicate where the shared
+ # libraries live
+ if(WIN32)
+ set(GTEST_SHARED_LIB_DIR "${GTEST_ROOT}/bin")
+ set(GTEST_SHARED_LIBRARY_FILENAME
+ "${CMAKE_SHARED_LIBRARY_PREFIX}gtest${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ set(GTEST_SHARED_LIBRARY_LIB
+ "${GTEST_SHARED_LIB_DIR}/${GTEST_SHARED_LIBRARY_FILENAME}")
+
+ set(GTEST_MAIN_SHARED_LIB_DIR "${GTEST_ROOT}/bin")
+ set(GTEST_MAIN_SHARED_LIBRARY_FILENAME
+
"${CMAKE_SHARED_LIBRARY_PREFIX}gtest_main${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ set(GTEST_MAIN_SHARED_LIBRARY_LIB
+ "${GTEST_MAIN_SHARED_LIB_DIR}/${GTEST_MAIN_SHARED_LIBRARY_FILENAME}")
+
+ set_target_properties(GTest::gtest PROPERTIES IMPORTED_LOCATION
+
"${GTEST_SHARED_LIBRARY_LIB}")
+
+ set_target_properties(GTest::gtest_main
+ PROPERTIES IMPORTED_LOCATION
+ "${GTEST_MAIN_SHARED_LIBRARY_LIB}")
+ endif()
+
find_package(Arrow)
if(NOT Arrow_FOUND)
# Trigger an automatic build of the Arrow C++ libraries.
build_arrow()
endif()
endif()
+
else()
find_package(Arrow)
if(NOT Arrow_FOUND)
build_arrow()
endif()
endif()
+# On Windows: copy arrow.dll into the directory where the MATLAB C++ tests
reside,
+# since Windows require runtime DLLs that are depended on by executables to be
in
+# the same directory (or on the %PATH%).
+if(WIN32)
+ get_property(ARROW_SHARED_LIB
+ TARGET arrow_shared
+ PROPERTY IMPORTED_LOCATION)
+
+ add_custom_target(copy_arrow_to_build_output_dir ALL
+ COMMAND ${CMAKE_COMMAND} -E make_directory
${MATLAB_BUILD_OUTPUT_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${ARROW_SHARED_LIB}
+ ${MATLAB_BUILD_OUTPUT_DIR}
+ COMMENT "Start copying arrow.dll from ${ARROW_SHARED_LIB}
to ${MATLAB_BUILD_OUTPUT_DIR}"
+ )
Review comment:
Can we use `%PATH%` for this too?
--
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]