使CMake选择静态连接可能吗? [英] Making CMake choose static linkage when possible?

查看:126
本文介绍了使CMake选择静态连接可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个与SOCI链接的项目,它既是静态库也是动态库。我想CMake选择静态版本,如果可用,否则动态。有没有合理的方法来做这个在CMake?

I'm working on a project that's link against SOCI, which comes as both static and dynamic libraries. I'd like CMake to choose the static version when available, and dynamic otherwise. Is there a reasonable way to do this in CMake? I've come up with nothing looking through the docs so far.

推荐答案

听起来像您需要添加CMAKE_EXE_LINKER_FLAGS = -static

Sounds like you need to add CMAKE_EXE_LINKER_FLAGS=-static

这篇关于使CMake选择静态连接可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆