cmake 检查库是否是静态的
有没有办法检查找到的库是否是静态库?为了找到该库,我这样做:
IF(WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ENDIF()
find_library(QUANTLIB_LIBRARY NAMES QuantLib PATHS ${QUANTLIB_LIBRARY_SEARCH})
但在 Windows 上,.lib
可能是 DLL 的符号文件。我需要确保这实际上是库的静态形式,否则稍后链接将导致难以理解的错误消息。
如果您想知道,我真的不想使用 satic 库,但 QuantLib 在多线程和共享库方面已被破坏。这是我让它正常工作的最佳机会:静态链接到我的共享库之一。
Is there a way to check if a found library is a static library? In order to find the library I do this:
IF(WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ENDIF()
find_library(QUANTLIB_LIBRARY NAMES QuantLib PATHS ${QUANTLIB_LIBRARY_SEARCH})
But on windows a .lib
could be the symbol file for a DLL. I need to ensure this is actually the static form of the library, otherwise linking later will result in hard-to-understand error messages.
In case you're wondering, I don't really want to use a satic library, but QuantLib is broken with respect to multithreading and shared libraries. This is my best chance at getting it working correctly: statically link to one of my shared libraries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果正确地将库添加为目标,您应该能够执行类似的操作。
有关详细信息,请参阅
TYPE
。If the library is added as a target properly you should be able to do something like this.
See
TYPE
for details.