Skip to content

Commit

Permalink
Merge pull request #80 from lawruble13/static-gtest
Browse files Browse the repository at this point in the history
HOTFIX: Statically link googletest
  • Loading branch information
mkarunan authored Oct 20, 2022
2 parents 00d4fac + e4151ab commit 849a36c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ include( FetchContent )

FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 609281088cfefc76f9d0ce82e1ff6c30cc3591e5
)
FetchContent_MakeAvailable(googletest)

include(GoogleTest)
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
# Fetch the content using default details
FetchContent_Populate(googletest)
# Save the shared libs setting, then force to static libs
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build SHARED libraries" FORCE)
# Add gtest targets as static libs
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
# Restore shared libs setting
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE INTERNAL "Build SHARED libraries" FORCE)
endif()

set(ROCWMMA_TEST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
set(ROCWMMA_COMMON_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/hip_device.cpp
Expand Down

0 comments on commit 849a36c

Please sign in to comment.