In converting from automake to cmake, I have to carry over some tests for function existence. I didn't write the configure.ac script, but I do have to reproduce the functionality as closely as follows, so please don't berate me about these checks. I have to make them.
So, I'm trying to use the CheckFunctionExists module to check for the existence of the time function (among others). Here's the cmake code
include(CheckIncludeFiles)
CHECK_FUNCTION_EXISTS(time, HAVE_TIME_FUNCTION)
if(NOT HAVE_TIME_FUNCTION)
message(FATAL_ERROR "ERROR: required time function not found")
endif(NOT HAVE_TIME_FUNCTION)
This fails every time, even though I know for a fact that I have the time funcion (duh). I tried replacing time with printf and it still fails. Is there some setup I have to do to make this check work correctly?
You should remove the ,
:
CHECK_FUNCTION_EXISTS(time HAVE_TIME_FUNCTION)
In CMake, separators are spaces or semi-colons, the comma is part of the variable.
Include the CMake standard module CheckFunctionExists
and remove the comma in the check_function_exists
invocation:
include(CheckFunctionExists)
check_function_exists(time HAVE_TIME_FUNCTION)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With