我在我的一个项目中使用了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!那么,为什么上面显示的代码可以找到函数,但没有设置变量呢?或者是其他原因?
https://stackoverflow.com/questions/44579381
复制相似问题