Strange error occurred while using cmake

the_drow picture the_drow · Dec 13, 2009 · Viewed 10.4k times · Source

Does anyone know what "The C compiler "cl" is not able to compile a simple test program." means?
I am trying to compile Wt using CMake on MSVC 9.
The OS is Windows XP.
Here is the full log:

Check for working C compiler: cl Check for working C compiler: cl -- broken CMake Error at I:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE): The C compiler "cl" is not able to compile a simple test program.

It fails with the following output:

Change Dir: I:/SophisPal/build/CMakeFiles/CMakeTmp

Run Build Command:C:\PROGRA~1\MICROS~1.0\Common7\IDE\VCExpress.exe CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec

Microsoft (R) Visual C++ Express Edition Version 9.0.30729.1.

Copyright (C) Microsoft Corp 2007. All rights reserved.

1>------ Build started: Project: cmTryCompileExec, Configuration: Debug Win32 ------

1>Compiling...

1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86

1>Copyright (C) Microsoft Corporation. All rights reserved.

1>cl /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "CMAKE_INTDIR=\"Debug\""
/D "_MBCS" /FD /RTCs /MDd /Fo"cmTryCompileExec.dir\Debug\"
/Fd"I:/SophisPal/build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec.pdb" /W3 /c /Zi /TC /Zm1000

1> .\testCCompiler.c

1>testCCompiler.c

1>Compiling manifest to resources...

1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1

1>Copyright (C) Microsoft Corporation. All rights reserved.

1>Linking...

1>Embedding manifest...

1>Project : error PRJ0003 : Error spawning 'cmd.exe'.

1>Build log was saved at
"file://i:\SophisPal\build\CMakeFiles\CMakeTmp\cmTryCompileExec.dir\Debug\BuildLog.htm"

1>cmTryCompileExec - 1 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

CMake will not be able to correctly generate this project. Call Stack (most recent call first):
CMakeLists.txt:7 (PROJECT)

Configuring incomplete, errors occurred!

Answer

Mike Weller picture Mike Weller · Dec 13, 2009

I googled for the cmd.exe error and came up with this page. Looks like Visual studio needs to be configured with a few paths so it knows how to find cmd.exe. Here are the steps from that thread:

What you must do is change MSVS options (Tools menu > Options > Project and Solutions > VC++ Directories) to ensure that

$(SystemRoot)

$(SystemRoot)\System32

$(SystemRoot)\System32\wbem

are specified BEFORE $(PATH).