I'm using the alloca
function in one of my projects and decided to use CMake to make sure it's available. So I added this bit to my CMakeLists.txt file:
include(CheckSymbolExists)
check_symbol_exists(alloca stdlib.h;cstdlib ALLOCA_EXISTS)
if (NOT ALLOCA_EXISTS)
message(FATAL_ERROR "Platform does not support alloca")
endif ()
When I run CMake, this is the (relevant part of the) output:
-- Looking for alloca
-- Looking for alloca - found
CMake Error at CMakeLists.txt:11 (message):
Platform does not support alloca
-- Configuring incomplete, errors occurred!
So how come the shown code finds the function but doesn't set the variable? Or is it something else?