3

I'm typically using CMake to compile my contracts, like described here.

How can I pass specific eosio-cpp/eosio-ld options (specifically -stack-size) described here?

1 Answer 1

3

cmake will compile source files into object files first and link them by linker, so you need to add -stack-size option to linker option. (When you run eosio-cpp in command-line, passing -stack-size to compile options is allowed, because eosio-cpp will pass linker options to eosio-ld)

add_contract(test test test.cpp)
target_link_options(test PUBLIC -stack-size=8192)
5
  • awesome, thank you @conrad!
    – cmadh
    Dec 17, 2020 at 13:34
  • 1
    sidenote for everyone reading this: target_link_options is only available in versions >= 3.13
    – cmadh
    Dec 17, 2020 at 14:00
  • @conrad, is there a way to pass options like -finline-functions and -finline-hint-functions via cmake?
    – cmadh
    Dec 22, 2020 at 17:53
  • 1
    @cmadh You can use target_compile_options(test PUBLIC -finline-functions) for them. My ID is conr"2"d, not conrad, haha.
    – conr2d
    Dec 23, 2020 at 1:10
  • oh, sry @conr2d :D. Thank you!
    – cmadh
    Dec 25, 2020 at 18:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.