How do I tell cmake I want my project to link libraries statically?

后端 未结 7 573
暗喜
暗喜 2020-12-14 02:15

I\'m trying to build an OpenCV-based project using CMake, running on Linux. So far my CMakeLists.txt files looks something like

FIND_PACKAGE (Op         


        
7条回答
  •  隐瞒了意图╮
    2020-12-14 02:55

    AFAIK that's a bit tricky, because CMake, more precisely the find_library command, prefers shared libs and finds those if both shared and static are available.

    I'm still looking for a good solution myself to be able to compile binaries "as static as possible", but I've found no elegant solution yet. The only way it would surely work is to implement everything through custom FindXXXX modules.

提交回复
热议问题