I normally use eosio-cpp to compile my smart contract, but recently I needed to use an external lib and link to it to build my project.

I checked the docs here, but it basically shows how to use cmake to build a very basic project without any external libraries. Basically, there is the add_contract macro instead of add_library, which can be used to defined the contract.

However, how can add/link external libraries? I tried target_link_libraries but it did not work. Am I missing something? is there any full example of how to integrate external libraries?

Thanks in advance

  • What's the problem with using add_library ?
    – cmadh
    Nov 5, 2021 at 23:29
  • @cmadh add_library will output a .a or .so file depending on the configuration. However, to build a contract I need to use add_contract as mentioned the eosio docs in order to get a .wasm and .abi output files
    – basilisk
    Nov 6, 2021 at 9:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.