Compiling a static executable with CMake

后端 未结 2 1303
耶瑟儿~
耶瑟儿~ 2020-11-28 08:16

for a project I need to create an executable that includes all the libraries that I used (opencv, cgal) in order to execute it on a computer that has not those libraries. Cu

2条回答
  •  粉色の甜心
    2020-11-28 08:41

    Add these lines after add_executable(MyExec "main.c") (for exemple) :

    target_link_libraries(MyExec PUBLIC "-static")

    or before : link_libraries("-static")

提交回复
热议问题