Skip to content

Commit

Permalink
Fixed Windows gtest path
Browse files Browse the repository at this point in the history
  • Loading branch information
bialger committed Feb 13, 2024
1 parent f21f2dc commit dbd988e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ target_link_libraries(
GTest::gtest_main
)

if(WIN32)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_custom_command(TARGET ${PROJECT_NAME}_tests POST_BUILD
COMMAND "cp" ARGS "${CMAKE_BINARY_DIR}/bin/Debug/gtest.dll" "${CMAKE_BINARY_DIR}/Debug/gtest.dll"
COMMAND "cp" ARGS "${CMAKE_BINARY_DIR}/bin/Debug/gtest_main.dll" "${CMAKE_BINARY_DIR}/Debug/gtest_main.dll"
COMMENT "Copying to output directory")
else ()
add_custom_command(TARGET ${PROJECT_NAME}_tests POST_BUILD
COMMAND "cp" ARGS "${CMAKE_BINARY_DIR}/bin/libgtest.dll" "${CMAKE_BINARY_DIR}/libgtest.dll"
COMMAND "cp" ARGS "${CMAKE_BINARY_DIR}/bin/libgtest_main.dll" "${CMAKE_BINARY_DIR}/libgtest_main.dll"
COMMENT "Copying to output directory")
endif()
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug) # Tests should be built with Debug
endif()
Expand Down

0 comments on commit dbd988e

Please sign in to comment.