Skip to content

Commit

Permalink
fix windows gtest problem
Browse files Browse the repository at this point in the history
  • Loading branch information
chistopher committed Oct 11, 2023
1 parent cd81684 commit cfdcf56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 5 additions & 4 deletions source/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ set(BUILD_GMOCK OFF) # see bug https://github.com/google/googletest/issues/4384
# earlier CMake or a failed find_package(GTest) call lead to a download in the build dir
FetchContent_MakeAvailable(GTest)

# windows needs gtest.dll in PATH. Installed versions should have this, but downloaded do not.
# To find DLL at test runtime (and during gtest_discover_tests()), we generate the gtest.dll in the same dir as the test .exe
# see https://github.com/google/googletest/issues/3565
if(MSVC)
foreach(target gtest gtest_main)
set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
endforeach()
if(WIN32)
set_target_properties(gtest PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(gtest_main PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
endif()

add_subdirectory(girgs-test)
Expand Down
5 changes: 0 additions & 5 deletions source/tests/girgs-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,4 @@ target_link_libraries(${target}
${DEFAULT_LINKER_OPTIONS}
)


if(WIN32)
add_custom_target(genexdebug ALL COMMAND ${CMAKE_COMMAND} -E echo "DLLS: $<TARGET_RUNTIME_DLLS:${target}>")
endif()

gtest_discover_tests(${target})

0 comments on commit cfdcf56

Please sign in to comment.