Skip to content

Commit

Permalink
Make sure that we can link GTest on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Urbanke committed Apr 21, 2024
1 parent df04739 commit 5a40b9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ endif ()
target_compile_options(reflectcpp PRIVATE -Wall)

if (REFLECTCPP_BUILD_TESTS)
if (MSVC)
set(REFLECT_CPP_GTEST_LIB "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/gtest${CMAKE_STATIC_LIBRARY_SUFFIX}")
else ()
set(REFLECT_CPP_GTEST_LIB "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libgtest${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif ()
add_subdirectory(tests)
endif ()

Expand Down
2 changes: 1 addition & 1 deletion tests/json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ target_link_libraries(
reflect-cpp-json-tests
PRIVATE
reflectcpp
"${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libgtest.a"
"${REFLECT_CPP_GTEST_LIB}"
)

0 comments on commit 5a40b9f

Please sign in to comment.