diff options
author | ambrosin <ambrosin@google.com> | 2021-10-12 13:01:00 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2021-10-12 13:01:41 -0700 |
commit | 4b4091c8bd8c43788009bb6a5f728cc2630fbe99 (patch) | |
tree | d7b4a7676ae1fddb7c11c72be320bb0502798a95 /cmake | |
parent | 225c4f210fce3c3aece35b5438c4be795e8f44bc (diff) | |
download | tink-4b4091c8bd8c43788009bb6a5f728cc2630fbe99.tar.gz |
Changes to CMake config files to allow linking to OpenSSL installed in the system.
Tested with:
```
cmake .. -DTINK_USE_SYSTEM_OPENSSL=ON -DTINK_BUILD_TESTS=ON
make tink_test_subtle_random_test
./cc/subtle/tink_test_subtle_random_test
```
PiperOrigin-RevId: 402634773
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/TinkWorkspace.cmake | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/cmake/TinkWorkspace.cmake b/cmake/TinkWorkspace.cmake index d17c30a66..03aa8a51c 100644 --- a/cmake/TinkWorkspace.cmake +++ b/cmake/TinkWorkspace.cmake @@ -61,15 +61,22 @@ http_archive( # Paths are hard-coded in tests, which expects wycheproof/ in this location. add_directory_alias("${wycheproof_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/cc/wycheproof") -http_archive( - NAME boringssl - URL https://github.com/google/boringssl/archive/7686eb8ac9bc60198cbc8354fcba7f54c02792ec.zip - SHA256 73a7bc71f95f3259ddedc6cb5ba45d02f2359c43e75af354928b0471a428bb84 - CMAKE_SUBDIR src -) +if (NOT TINK_USE_SYSTEM_OPENSSL) + http_archive( + NAME boringssl + URL https://github.com/google/boringssl/archive/7686eb8ac9bc60198cbc8354fcba7f54c02792ec.zip + SHA256 73a7bc71f95f3259ddedc6cb5ba45d02f2359c43e75af354928b0471a428bb84 + CMAKE_SUBDIR src + ) -# BoringSSL targets do not carry include directory info, this fixes it. -target_include_directories(crypto PUBLIC "${boringssl_SOURCE_DIR}/src/include") + # BoringSSL targets do not carry include directory info, this fixes it. + target_include_directories(crypto PUBLIC "${boringssl_SOURCE_DIR}/src/include") +else() + add_library(crypto INTERFACE) + find_package(OpenSSL 1.1.0 REQUIRED) + target_link_libraries(crypto INTERFACE OpenSSL::Crypto) + target_include_directories(crypto INTERFACE OpenSSL::Crypto) +endif() set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "Tink dependency override" FORCE) set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "Tink dependency override" FORCE) |