Skip to content

Commit

Permalink
apacheGH-38077: [C++] Output bundled GoogleTest to ${BUILD_DIR}/${CON…
Browse files Browse the repository at this point in the history
…FIG} (apache#38132)

### Rationale for this change

To find DLLs on Windows, we need to add a directory of these DLLs to PATH or put these DLLs to the same directory of the target .exe.

### What changes are included in this PR?

Output bundled GoogleTest's DLLs to the same directory of the test .exe.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* Closes: apache#38077

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
kou authored and loicalleyne committed Nov 13, 2023
1 parent cd6452a commit b80ca62
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2139,10 +2139,22 @@ function(build_gtest)
FORCE)
string(APPEND CMAKE_INSTALL_INCLUDEDIR "/arrow-gtest")
fetchcontent_makeavailable(googletest)
set_target_properties(gmock PROPERTIES OUTPUT_NAME "arrow_gmock")
set_target_properties(gmock_main PROPERTIES OUTPUT_NAME "arrow_gmock_main")
set_target_properties(gtest PROPERTIES OUTPUT_NAME "arrow_gtest")
set_target_properties(gtest_main PROPERTIES OUTPUT_NAME "arrow_gtest_main")
foreach(target gmock gmock_main gtest gtest_main)
set_target_properties(${target}
PROPERTIES OUTPUT_NAME "arrow_${target}"
PDB_NAME "arrow_${target}"
PDB_NAME_DEBUG "arrow_${target}d"
COMPILE_PDB_NAME "arrow_${target}"
COMPILE_PDB_NAME_DEBUG "arrow_${target}d"
RUNTIME_OUTPUT_DIRECTORY
"${BUILD_OUTPUT_ROOT_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY
"${BUILD_OUTPUT_ROOT_DIRECTORY}"
ARCHIVE_OUTPUT_DIRECTORY
"${BUILD_OUTPUT_ROOT_DIRECTORY}"
PDB_OUTPUT_DIRECTORY
"${BUILD_OUTPUT_ROOT_DIRECTORY}")
endforeach()
install(DIRECTORY "${googletest_SOURCE_DIR}/googlemock/include/"
"${googletest_SOURCE_DIR}/googletest/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
Expand Down

0 comments on commit b80ca62

Please sign in to comment.