Try setting CMAKE_REQUIRED_LIBRARIES to kernel32 (or maybe kernel32.lib?) before checking for Sleep.<br><br>SET(CMAKE_REQUIRED_LIBRARIES "kernel32")<br>
CHECK_FUNCTION_EXISTS(Sleep HAVE_SLEEP)<br><br>Does that work?<br><br><br><div class="gmail_quote">On Sat, Apr 12, 2008 at 6:21 AM, George Neill <<a href="mailto:georgen@neillnet.com">georgen@neillnet.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi CMakers,<br>
<br>
I feel rather stupid asking this question, but here I go. I have the<br>
following simple CMakeLists.txt file (on the windows platform, default<br>
MSVC compiler install).<br>
<br>
<br>
C:\Documents and Settings\gneill\Desktop\tmp>type CMakeLists.txt<br>
<br>
PROJECT(GEORGE C)<br>
<br>
include(CheckFunctionExists)<br>
<br>
CHECK_FUNCTION_EXISTS(Sleep HAVE_SLEEP)<br>
CHECK_FUNCTION_EXISTS(strtod HAVE_STRTOD)<br>
<br>
<br>
Here's the result,<br>
<br>
C:\Documents and Settings\gneill\Desktop\tmp>cmake .<br>
<br>
-- Check for working C compiler: C:/Program Files/Microsoft Visual<br>
Studio .NET 2003/Vc7/bin/cl.exe<br>
-- Check for working C compiler: C:/Program Files/Microsoft Visual<br>
Studio .NET 2003/Vc7/bin/cl.exe -- works<br>
-- Check size of void*<br>
-- Check size of void* - done<br>
-- Looking for Sleep<br>
-- Looking for Sleep - not found<br>
-- Looking for strtod<br>
-- Looking for strtod - found<br>
-- Configuring done<br>
-- Generating done<br>
-- Build files have been written to: C:/Documents and<br>
Settings/gneill/Desktop/tmp<br>
<br>
<br>
Is there some trick to making it find Sleep() (which is located in<br>
windows.h/kernel32.lib)? It's appears to be able to find strtod which<br>
is in the CRT.<br>
<br>
I have also tried adding (below) with no luck,<br>
<br>
SET(CMAKE_REQUIRED_LIBRARIES kernel32 user32)<br>
<br>
Here's what I am seeing in CMakeFiles\CMakeError.log<br>
<br>
Determining if the function Sleep exists failed with the following output:<br>
<br>
Microsoft (R) Development Environment Version 7.10.6030.<br>
Copyright (C) Microsoft Corp 1984-2001. All rights reserved.<br>
<br>
------ Build started: Project: cmTryCompileExec, Configuration: Debug<br>
Win32 ------<br>
<br>
Compiling...<br>
<br>
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.6030 for 80x86<br>
<br>
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.<br>
cl /Od /D "WIN32" /D "_WINDOWS" /D "CHECK_FUNCTION_EXISTS=Sleep" /D "_DEBUG" /D<br>
"CMAKE_INTDIR=\"Debug\"" /D "_MBCS" /FD /RTCs /MDd /GS /Fo"cmTryCompileExec.dir\<br>
Debug\\" /Fd"C:/Documents and Settings/gneill/Desktop/tmp/CMakeFiles/CMakeTmp/De<br>
bug/cmTryCompileExec.pdb" /W3 /c /Zi /TC /Zm1000<br>
"\Program Files\CMake 2.4\share\cmake-2.4\Modules\CheckFunctionExists.c"<br>
CheckFunctionExists.c<br>
Linking...<br>
CheckFunctionExists.obj : error LNK2019: unresolved external symbol<br>
_Sleep referenced in function _main<br>
<br>
Debug\cmTryCompileExec.exe : fatal error LNK1120: 1 unresolved externals<br>
<br>
Build log was saved at "file://c:\Documents and<br>
Settings\gneill\Desktop\tmp\CMakeFiles\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm"<br>
<br>
cmTryCompileExec - 2 error(s), 0 warning(s)<br>
<br>
---------------------- Done ----------------------<br>
<br>
Build: 0 succeeded, 1 failed, 0 skipped<br>
<br>
<br>
Maybe I just have something misconfigured (or missing something<br>
simple) .. any suggestions?<br>
<br>
<br>
TIA,<br>
George.<br>
_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>