2
我在其中一個項目中使用alloca
函數,並決定使用CMake來確保它可用。所以我說這一點對我的CMakeLists.txt文件:爲什麼這個CMake腳本找到「alloca」並仍然失敗?
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!
那麼怎麼來的顯示代碼發現函數但不設置變量?或者是別的什麼?