microsoft / cppgraphqlgen

C++ GraphQL schema service generator
MIT License
326 stars 46 forks source link

Still got "target was not found." error in the example #298

Closed karajan1001 closed 6 months ago

karajan1001 commented 6 months ago

Hello, team

I'm learning to use cppgraphqlgen, it is a fantastic project. And I successfully transferred some of my graphql requests into CPP codes. The package was installed via vcpkg and I downloaded a separate cppgraphqlgen for testing. And navigate the samples/proxy/ for tests, But I got this error after cmake .

CMake Error at /Users/gao/Code/cppgraphqlgen/cmake/cppgraphqlgen-functions.cmake:92 (target_link_libraries):
  Target "proxy_client" links to:

    cppgraphqlgen::graphqlclient

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  CMakeLists.txt:13 (add_graphql_client_target)

After looking through the tickets here, and followed the #170 I removed the CMakeCache.txt and CMakeFiles and tried cmake . -DCMAKE_TOOLCHAIN_FILE=<mylocal vcpkg path>/scripts/buildsystems/vcpkg.cmake I still got the same error as about, any ideas about how to solve this?

BTW, I'm using MacOS from m1 version of the MacBook Pro.

karajan1001 commented 6 months ago

looks like the tests passed after I rebuild from source