使用 cmake-gui 配置时收到 cmake 错误:
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
9.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/admin/Desktop/myproject/CMakeFiles/CMakeTmp
Run Build Command:c:\PROGRA~2\MICROS~1.0\Common7\IDE\devenv.com
CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec
Microsoft (R) Visual Studio Version 9.0.21022.8.
Copyright (C) Microsoft Corp. 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.21022.08 for
80x86
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>cl /D "CMAKE_INTDIR=\"Debug\"" /D "_MBCS" /FD /MT
/Fo"cmTryCompileExec.dir\Debug\\"
/Fd"C:\Users\admin\Desktop\myproject\CMakeFiles\CMakeTmp\Debug/cmTryCompileExec.pdb"
/c /TC .\testCCompiler.c
1>testCCompiler.c
1>Linking...
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
1>Build log was saved at
"file://C:\Users\admin\Desktop\myproject\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不能让vs编译器找到它需要的库?