[CMake] CMake 2.8.3 with VC2010 - CHECK_FUNCTION_EXISTS failed

Dongsheng Song dongsheng.song at gmail.com
Tue Jan 25 20:43:10 EST 2011


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 <bill.hoffman at kitware.com>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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110126/1885a2ff/attachment-0001.htm>


More information about the CMake mailing list