检查原型定义

检查我们期望的原型是否正确。

check_prototype_definition
check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
FUNCTION - The name of the function (used to check if prototype exists)
PROTOTYPE- The prototype to check.
RETURN - The return value of the function.
HEADER - The header files required.
VARIABLE - The variable to store the result.
           Will be created as an internal cache variable.

例子:

check_prototype_definition(getpwent_r
 "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
 "NULL"
 "unistd.h;pwd.h"
 SOLARIS_GETPWENT_R)

在调用此函数以修改检查运行方式之前,可以设置以下变量:

CMAKE_REQUIRED_FLAGS

编译命令行标志的字符串。

CMAKE_REQUIRED_DEFINITIONS

要定义的宏列表 (-DFOO=bar)。

CMAKE_REQUIRED_INCLUDES

包含目录列表。

CMAKE_REQUIRED_LINK_OPTIONS

在 3.14 版本加入: 传递给链接命令的选项列表。

CMAKE_REQUIRED_LIBRARIES

要链接的库列表。

CMAKE_REQUIRED_QUIET

在 3.1 版本加入: 在没有消息的情况下安静地执行。