【发布时间】:2017-11-18 15:34:11
【问题描述】:
我在我的一个项目中使用了alloca 函数,并决定使用 CMake 来确保它可用。所以我将此位添加到我的 CMakeLists.txt 文件中:
include(CheckSymbolExists)
check_symbol_exists(alloca stdlib.h;cstdlib ALLOCA_EXISTS)
if (NOT ALLOCA_EXISTS)
message(FATAL_ERROR "Platform does not support alloca")
endif ()
当我运行 CMake 时,这是(相关部分)输出:
-- Looking for alloca
-- Looking for alloca - found
CMake Error at CMakeLists.txt:11 (message):
Platform does not support alloca
-- Configuring incomplete, errors occurred!
那么为什么显示的代码找到了函数但没有设置变量?还是别的什么?
【问题讨论】: