CMake 3.8.0在生成文件中生成错误的链接命令 [英] CMake 3.8.0 generates wrong link command in makefiles

查看:199
本文介绍了CMake 3.8.0在生成文件中生成错误的链接命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行cmake生成一个带有STATIC库的项目,该项目成功完成后,ninja和mingw32-make都无法使其目标链接.对于共享库或可执行文件,此相同设置可以正常工作.我已经为忍者"和"MinGW Makefiles"生成器尝试过:

After I run cmake to generate a project with a STATIC library, which completes successfully, both ninja and mingw32-make fail to make their targets at linking. For SHARED libraries or executables this same setup worked fine. I've tried this both for "Ninja" and "MinGW Makefiles" generators:

忍者输出:

[2/2] Linking CXX static library hello_wsl.lib
FAILED: hello_wsl.lib
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E remove hello_wsl.lib && "" qc hello_wsl.lib  CMakeFiles/hello_wsl.dir/lib_hello_world.cpp.obj && cd ."
"""" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
ninja: build stopped: subcommand failed.

mingw32-make输出:

mingw32-make output:

Scanning dependencies of target hello_wsl
[ 50%] Building CXX object CMakeFiles/hello_wsl.dir/lib_hello_world.cpp.obj
[100%] Linking CXX static library hello_wsl.lib
Error running link command: El parámetro no es correcto
CMakeFiles\hello_wsl.dir\build.make:93: recipe for target 'hello_wsl.lib' failed
mingw32-make.exe[2]: *** [hello_wsl.lib] Error 2
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/hello_wsl.dir/all' failed
mingw32-make.exe[1]: *** [CMakeFiles/hello_wsl.dir/all] Error 2
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2

还要看看由"MinGW Makefiles"生成的"project_root \ build \ CMakeFiles \ hello_wsl.dir \ link.txt":

Also take a look at "project_root\build\CMakeFiles\hello_wsl.dir\link.txt" generated by "MinGW Makefiles":

"" qc hello_wsl.lib  CMakeFiles/hello_wsl.dir/lib_hello_world.cpp.obj


分步示例项目,以重现"MinGW Makefiles"的问题:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆