Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmake/common/targets/googletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ function(sourcemeta_googletest)

target_link_libraries("${TARGET_NAME}"
PRIVATE GTest::gtest GTest::gmock GTest::gtest_main)

# Test executables are not shipped, so LTO buys nothing and significantly
# slows the link step (GCC's LTRANS phase serializes per executable)
if(SOURCEMETA_COMPILER_LLVM OR SOURCEMETA_COMPILER_GCC)
target_compile_options("${TARGET_NAME}" PRIVATE -fno-lto)
target_link_options("${TARGET_NAME}" PRIVATE -fno-lto)
Comment thread
jviotti marked this conversation as resolved.
endif()

add_test(NAME "${SOURCEMETA_GOOGLETEST_PROJECT}.${SOURCEMETA_GOOGLETEST_NAME}"
COMMAND "${TARGET_NAME}" --gtest_brief=1)
endfunction()
Loading