0

I am trying to build a library that uses the Google tink library and the AWS C++ SDK, but it fails with the following error:

Target "tcc-tink" links to target "AWS::Crypto" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing

The relevant AWS CMakeFile.txt seems to support targets of both "crypto" and "AWS::crypto", although this file may be solely for its own use during a build:

https://github.com/aws/aws-sdk-cpp/blob/main/cmake/Findcrypto.cmake

I tried copying this file to an identical file named FindAWScrypto.cmake in the same AWS C++ SDK source directory, but that didn't work.

I have also tried all kinds of combinations of find_target() and add_library(), to both my library's CMakeLists.txt (quoted below) and the above crypto file, all to no avail.

What I think needs to happen is a directive added to my library's CMakeLists.txt to tell it that the reference is has to "AWS::crypt" is actually a reference to "crypt", but nothing I try seems to work!

It is also not clear where or how my code generates the reference to AWS::crypt!

My CMakeLists.txt file comprises:

cmake_minimum_required(VERSION 3.5)
project(tcc-tink CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory(tink)

find_package(AWSSDK REQUIRED COMPONENTS kms)
add_library(tink-kms STATIC tink/cc/integration/awskms/aws_crypto.cc tink/cc/integration/awskms/aws_kms_aead.cc)
target_include_directories(tink-kms PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/tink/__include_alias")
target_include_directories(tink-kms PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/tink/__third_party/com_google_absl/src")
target_include_directories(tink-kms PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/tink/__third_party/boringssl/src/src/include")

add_library(tcc-tink SHARED tcc_tink.cpp aws_kms_client.cpp dummy_kms_client.cpp)
target_link_libraries(tcc-tink PUBLIC tink::static aws-cpp-sdk-kms tink-kms)
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
John R Ramsden
  • 355
  • 4
  • 14
  • 1
    The error message should accompanied with some location, like in [that question](https://stackoverflow.com/questions/69996240/cmake-target-links-to-transitive-dependency-target-but-the-target-was-not-found). Also, the script `FindAWScrypto.cmake` should output useful information. Please, add to the question post the **whole output** of CMake. – Tsyvarev Feb 14 '23 at 17:14
  • I agree with @Tsyvarev here, I think you are not giving us the "whole picture" – Milan Š. Feb 14 '23 at 20:14

0 Answers0