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>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0808d7..1a1a008 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -512,9 +512,11 @@
# Add minimal googletest targets. The provided one has many side-effects, and
# googletest has a very straightforward build.
add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc)
-target_include_directories(boringssl_gtest PRIVATE third_party/googletest)
-
-include_directories(third_party/googletest/include)
+target_include_directories(
+ boringssl_gtest
+ PUBLIC third_party/googletest/include
+ PRIVATE third_party/googletest
+)
# Declare a dummy target to build all unit tests. Test targets should inject
# themselves as dependencies next to the target definition.
diff --git a/crypto/test/CMakeLists.txt b/crypto/test/CMakeLists.txt
index bf20863..939cbb6 100644
--- a/crypto/test/CMakeLists.txt
+++ b/crypto/test/CMakeLists.txt
@@ -17,6 +17,7 @@
if(WIN32)
target_link_libraries(test_support_lib dbghelp)
endif()
+target_link_libraries(test_support_lib boringssl_gtest crypto)
add_dependencies(test_support_lib global_target)
add_library(
@@ -28,3 +29,4 @@
)
add_dependencies(boringssl_gtest_main global_target)
+target_link_libraries(boringssl_gtest_main boringssl_gtest crypto test_support_lib)