Clean up test_support_lib and GTest dependencies slightly.

test_support_lib depends on GTest and should be marked as such.
Historically it was a bit fuzzy, but now it's unambiguous.

With that cleaned up, we can remove one of the global
include_directories calls and rely on CMake's
INTERFACE_INCLUDE_DIRECTORIES machinery.

(CMake's documentation and "modern CMake" prefers setting include
directories on the target and letting them flow up the dependency tree,
rather than configuring it globally across the project.)

Change-Id: I364df834d62328b69f146fbe35c10af97618a713
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56567
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
fips-20230428
David Benjamin 2 years ago committed by Boringssl LUCI CQ
parent f7d37fba96
commit 8bc06cf491
  1. 8
      CMakeLists.txt
  2. 2
      crypto/test/CMakeLists.txt

@ -512,9 +512,11 @@ endif()
# Add minimal googletest targets. The provided one has many side-effects, and # Add minimal googletest targets. The provided one has many side-effects, and
# googletest has a very straightforward build. # googletest has a very straightforward build.
add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc) add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc)
target_include_directories(boringssl_gtest PRIVATE third_party/googletest) target_include_directories(
boringssl_gtest
include_directories(third_party/googletest/include) PUBLIC third_party/googletest/include
PRIVATE third_party/googletest
)
# Declare a dummy target to build all unit tests. Test targets should inject # Declare a dummy target to build all unit tests. Test targets should inject
# themselves as dependencies next to the target definition. # themselves as dependencies next to the target definition.

@ -17,6 +17,7 @@ endif()
if(WIN32) if(WIN32)
target_link_libraries(test_support_lib dbghelp) target_link_libraries(test_support_lib dbghelp)
endif() endif()
target_link_libraries(test_support_lib boringssl_gtest crypto)
add_dependencies(test_support_lib global_target) add_dependencies(test_support_lib global_target)
add_library( add_library(
@ -28,3 +29,4 @@ add_library(
) )
add_dependencies(boringssl_gtest_main global_target) add_dependencies(boringssl_gtest_main global_target)
target_link_libraries(boringssl_gtest_main boringssl_gtest crypto test_support_lib)

Loading…
Cancel
Save