【问题标题】:How to check for a symbol that requires two header files in CMake?如何在 CMake 中检查需要两个头文件的符号?
【发布时间】:2012-11-28 18:21:01
【问题描述】:

要定义符号 getifaddrs,您必须同时包含 sys/types.h 和 ifaddrs.h。在检查符号是否存在时,我尝试了以下方法:

set (CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
check_symbol_exists (getifaddrs ifaddrs.h SP_HAVE_IFADDRS)
set (CMAKE_EXTRA_INCLUDE_FILES)

但是,测试程序仍然只包含 ifaddrs.h,因此无法检测到该符号。

如何强制它也包含 sys/types.h?

【问题讨论】:

    标签: header cmake symbols


    【解决方案1】:

    这行得通:

    check_symbol_exists (getifaddrs "sys/types.h;ifaddrs.h" SP_HAVE_IFADDRS)

    【讨论】:

      猜你喜欢
      • 2021-05-08
      • 1970-01-01
      • 1970-01-01
      • 2020-10-08
      • 1970-01-01
      • 1970-01-01
      • 2020-01-13
      • 2011-05-02
      • 1970-01-01
      相关资源
      最近更新 更多