Skip to content

Commit

Permalink
Fix Google Test being built as a shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortham committed Apr 28, 2024
1 parent 11c2d8b commit d22a2f6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ include(FetchContent)
set(BUILD_GMOCK OFF)
set(gtest_force_shared_crt ON)
set(INSTALL_GTEST OFF)
# Google Test doesn't have a scoped equivalent to BUILD_SHARED_LIBS, so set the
# global value and then set it back to the original value once Google Test has
# been configured.
set(BUILD_SHARED_LIBS_INITIAL ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
FetchContent_Declare(
GTest
URL "https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz"
Expand All @@ -20,6 +25,8 @@ FetchContent_Declare(

FetchContent_MakeAvailable(GTest testing-plugins)

set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_INITIAL})


##############################
# General Settings
Expand Down Expand Up @@ -50,12 +57,10 @@ set(LIBLOOT_SRC_TESTS_INTERNALS_H_FILES
"${CMAKE_SOURCE_DIR}/src/tests/api/internals/sorting/plugin_sort_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/api/internals/sorting/plugin_graph_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/api/internals/sorting/plugin_sorting_data_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/api/internals/metadata_list_test.h"
)
"${CMAKE_SOURCE_DIR}/src/tests/api/internals/metadata_list_test.h")

set(LIBLOOT_SRC_TESTS_INTERFACE_CPP_FILES
"${CMAKE_SOURCE_DIR}/src/tests/api/interface/main.cpp"
)
"${CMAKE_SOURCE_DIR}/src/tests/api/interface/main.cpp")

set(LIBLOOT_SRC_TESTS_INTERFACE_H_FILES
"${CMAKE_SOURCE_DIR}/src/tests/api/interface/api_game_operations_test.h"
Expand Down Expand Up @@ -219,6 +224,7 @@ add_custom_command(TARGET libloot_internals_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${testing-plugins_SOURCE_DIR}
$<TARGET_FILE_DIR:libloot_internals_tests>)

add_custom_command(TARGET libloot_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${testing-plugins_SOURCE_DIR}
Expand Down

0 comments on commit d22a2f6

Please sign in to comment.