Quantcast

CMake 2.8.3 with VC2010 - CHECK_FUNCTION_EXISTS failed

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CMake 2.8.3 with VC2010 - CHECK_FUNCTION_EXISTS failed

Dongsheng Song
Hi,

When I use the following CMakeLists.txt:

CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
CHECK_FUNCTION_EXISTS(log HAVE_LOG)
CHECK_FUNCTION_EXISTS(exp HAVE_EXP)

E:\var>cmake -G "NMake Makefiles"
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
-- Check for CL compiler version
-- Check for CL compiler version - 1600
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check for working C compiler: E:/usr/vs2010/VC/bin/cl.exe
-- Check for working C compiler: E:/usr/vs2010/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: E:/usr/vs2010/VC/bin/cl.exe
-- Check for working CXX compiler: E:/usr/vs2010/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for log
-- Looking for log - not found
-- Looking for exp
-- Looking for exp - not found
-- Configuring done
-- Generating done
-- Build files have been written to: E:/var

From the CMakeError.log file:
...
Building C object CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.obj

    E:\usr\vs2010\VC\bin\cl.exe  @C:\DOCUME~1\DONGSH~1\LOCALS~1\Temp\nm506.tmp

cl : Command line warning D9025 : overriding '/MD' with '/MDd'

cl : Command line warning D9025 : overriding '/O2' with '/Od'

CheckFunctionExists.c

E:\usr\CMake-2.8\share\cmake-2.8\Modules\CheckFunctionExists.c(21) : fatal error C1189: #error :  "CHECK_FUNCTION_EXISTS has to specify the function"
...

But I can success compile and link with the following command line:

E:\var>cl /DCHECK_FUNCTION_EXISTS=log E:\usr\CMake-2.8\share\cmake-2.8\Modules\CheckFunctionExists.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

CheckFunctionExists.c
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CheckFunctionExists.exe
CheckFunctionExists.obj

From the page http://www.cmake.org/Wiki/CMake_FAQ#Is_there_an_option_to_produce_more_.27verbose.27_compiling.3F

but when I set CMAKE_START_TEMP_FILE and CMAKE_END_TEMP_FILE to "" ,  CMakeError.log still include such lines:

E:\usr\vs2010\VC\bin\cl.exe  @C:\DOCUME~1\DONGSH~1\LOCALS~1\Temp\nm506.tmp

Then I can not check more details.

Thanks for some help.

--
Dongsheng

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 2.8.3 with VC2010 - CHECK_FUNCTION_EXISTS failed

Bill Hoffman
On 1/25/2011 9:14 AM, Dongsheng Song wrote:

>
>  From the page
> http://www.cmake.org/Wiki/CMake_FAQ#Is_there_an_option_to_produce_more_.27verbose.27_compiling.3F
>
> but when I set CMAKE_START_TEMP_FILE and CMAKE_END_TEMP_FILE to "" ,
> CMakeError.log still include such lines:
>
> E:\usr\vs2010\VC\bin\cl.exe  @C:\DOCUME~1\DONGSH~1\LOCALS~1\Temp\nm506.tmp
>

OK, so I just learned something about windows 7 today...  Welcome to
VirtualStore.   When you try to edit a file in Program Files as
non-admin, Windows silently creates another copy of the file for you to
edit.

For me it showed up here:
./AppData/Local/VirtualStore/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/Platform/Windows.cmake

CMake for some reason does not pick up this alternate file, and still
uses the original (unchanged) file in Program Files.  So, the FAQ is
still good, but you need to edit the file as admin to actually change it.

-Bill
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 2.8.3 with VC2010 - CHECK_FUNCTION_EXISTS failed

Dongsheng Song
Thanks, I known the reason why cmke can not found the crt functions:

When I set CFLAGS with double quotation marks:
SET CFLAGS=/nologo /W3 /EHsc /O2 /Oy- /Zi /D"_WIN32_WINNT=0x0502" /D"WIN32_LEAN_AND_MEAN=1"

Then cmake can issued invalid command lines like this:

CL.EXE   /nologo /nologo /W3 /EHsc /O2 /Oy- /Zi /D;_WIN32_WINNT=0x0502" /D"WIN32_LEAN_AND_MEAN=1" /DWIN32 /D_WINDOWS /W3 /Zm1000  -DCHECK_FUNCTION_EXISTS=exp" /D_DEBUG /MDd /Zi /Ob0 /Od /GZ  /FoCMakeFiles\cmTryCompileExec.dir\CheckFunctionExists.c.obj /FdC:\var\tmp\CMakeFiles\CMakeTmp\cmTryCompileExec.pdb -c C:\opt\CMake-2.8\share\cmake-2.8\Modules\CheckFunctionExists.c

This first double quotation mark was replaced by semicolon (" => ;) !!!

But after I changed to with the following line, no errors:
SET CFLAGS=/nologo /W3 /EHsc /O2 /Oy- /Zi /D_WIN32_WINNT=0x0502   /DWIN32_LEAN_AND_MEAN=1

Then I test LDFLAGS:
SET LDFLAGS=/OPT:ICF,REF /MACHINE:X86 /SUBSYSTEM:CONSOLE /RELEASE

Cmake still issued invalid command lines like this:

CL.EXE  /nologo @CMakeFiles\cmTryCompileExec.dir\objects1.rsp    /DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR   /D_DEBUG /MDd /Zi  /Ob0 /Od /GZ /FecmTryCompileExec.exe /FdC:\var\tmp\CMakeFiles\CMakeTmp\cmTryCompileExec.pdb -link /implib:cmTryCompileExec.lib /version:0.0   /STACK:10000000 /machine:X86;/OPT:ICF,REF /MACHINE:X86 /SUBSYSTEM:CONSOLE /RELEASE /debug /pdbtype:sept /INCREMENTAL:YES /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

/machine:X86;/OPT:ICF,REF should be /machine:X86 /OPT:ICF,REF !!!

Regards,
Dongsheng

On Wed, Jan 26, 2011 at 02:19, Bill Hoffman <[hidden email]> wrote:
On 1/25/2011 9:14 AM, Dongsheng Song wrote:


 From the page
http://www.cmake.org/Wiki/CMake_FAQ#Is_there_an_option_to_produce_more_.27verbose.27_compiling.3F

but when I set CMAKE_START_TEMP_FILE and CMAKE_END_TEMP_FILE to "" ,
CMakeError.log still include such lines:

E:\usr\vs2010\VC\bin\cl.exe  @C:\DOCUME~1\DONGSH~1\LOCALS~1\Temp\nm506.tmp


OK, so I just learned something about windows 7 today...  Welcome to VirtualStore.   When you try to edit a file in Program Files as non-admin, Windows silently creates another copy of the file for you to edit.

For me it showed up here:
./AppData/Local/VirtualStore/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows.cmake

CMake for some reason does not pick up this alternate file, and still uses the original (unchanged) file in Program Files.  So, the FAQ is still good, but you need to edit the file as admin to actually change it.

-Bill
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Loading...