[CMake] CHECK_FUNCTION_EXISTS
George Neill
georgen at neillnet.com
Sat Apr 12 17:33:08 EDT 2008
David,
> Try setting CMAKE_REQUIRED_LIBRARIES to kernel32 (or maybe kernel32.lib?)
> before checking for Sleep.
>
> SET(CMAKE_REQUIRED_LIBRARIES "kernel32")
>
> CHECK_FUNCTION_EXISTS(Sleep HAVE_SLEEP)
>
> Does that work?
No, it sure doesn't.
I tried
SET(CMAKE_REQUIRED_LIBRARIES "kernel32")
and
SET(CMAKE_REQUIRED_LIBRARIES "kernel32.lib")
as well as the unquoted versions in my previous post.
If it's worth anything, this simple program compiles and executes just
fine with no additional compiler flags or libraries. Before I run
cmake I set up my environment by running the vsvars32.bat file located
in the Tools directory of the MSVC install.
C:\Documents and Settings\gneill\Desktop\tmp>type george.c
#include <windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
fprintf(stdout, "sleeping.\n");
Sleep(1000);
fprintf(stdout, "done.\n");
return 0;
}
C:\Documents and Settings\gneill\Desktop\tmp>george
sleeping.
done.
TIA,
George.
More information about the CMake
mailing list