WillAyd commented on issue #47434:
URL: https://github.com/apache/arrow/issues/47434#issuecomment-3228546872

   It does link gtest main - here is the verbose output of a compilation 
showing the linkage:
   
   ```
   [3/3] cmake -E vs_link_exe --msvc-ver=1944 
--intdir=src\arrow\testing\CMakeFiles\arrow-gtest-util-test.dir 
--rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe 
--mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe --manifests  -- 
C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe
 /nologo 
src\arrow\testing\CMakeFiles\arrow-gtest-util-test.dir\gtest_util_test.cc.obj  
/out:release\arrow-gtest-util-test.exe 
/implib:release\arrow-gtest-util-test.lib 
/pdb:release\arrow-gtest-util-test.pdb /version:0.0 /machine:x64  
/NODEFAULTLIB:LIBCMT /INCREMENTAL:NO /subsystem:console  
release\arrow_testing.lib  release\arrow_gmock.lib  
release\arrow_gtest_main.lib  release\arrow.lib  ws2_32.lib  
release\arrow_gtest.lib  kernel32.lib user32.lib gdi32.lib winspool.lib 
shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
   ```
   
   From comparing to the Meson build that was working, I think I've pinpointed 
the issue down to the fact that CMake is linking both `gtest_main`, `gtest`, 
and `gmock`. If you combine those into one linkage back to `gmock_main` then 
things work as expected:
   
   ```sh
   cmake -E vs_link_exe --msvc-ver=1944 
--intdir=src\arrow\testing\CMakeFiles\arrow-gtest-util-test.dir 
--rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe 
--mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe --manifests  -- 
C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe
 /nologo 
src\arrow\testing\CMakeFiles\arrow-gtest-util-test.dir\gtest_util_test.cc.obj  
/out:release\arrow-gtest-util-test.exe 
/implib:release\arrow-gtest-util-test.lib 
/pdb:release\arrow-gtest-util-test.pdb /version:0.0 /machine:x64  
/NODEFAULTLIB:LIBCMT /INCREMENTAL:NO /subsystem:console  
release\arrow_testing.lib release\arrow_gmock_main.lib  release\arrow.lib  
ws2_32.lib   kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib 
ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
   ```


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