From 4807c73949138c9d9afb12438bdd25125784f6ac Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 8 Oct 2023 06:46:36 +0900 Subject: [PATCH] GH-38077: [C++] Output bundled GoogleTest to BUILD_DIR/CONFIG To find bundled GoogleTest DLLs, we need to set PATH or output GoogleTest DLLs to the same directory of test executables. The latter is used. --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 6d6a2bf7751ee..d194c455eaaaa 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -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}")