我有一个批处理文件,用一些参数启动CMake.exe,如果CMake中有任何错误(这是产品构建过程的一部分),我需要中断执行。问题是,%ERRORLEVEL%来自CMake.exe过程似乎永远是0,而stadard错误输出可能包含错误,如我如何处理CMake.exe错误
... -- Configuring done CMake Error at CMakeConfigs/My.cmake:77 (add_library): Cannot find source file: Resources/ActionIcons/ActionIcon_ABC.png Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx Call Stack (most recent call first): My/Path/CMakeLists.txt:149 (my_add_target) -- Generating done ...
我打算抛售标准错误输出到文件和grep/FINDSTR错误,但错误处理可以更优雅地完成?
谢谢。
[如何知道cmake项目代是否成功结束](https://stackoverflow.com/questions/38253153/how-to-know-whether-the-cmake-project-generation-ended- with-success) – Florian
如果你没有在你的问题中提供它,我们应该如何帮助你使用批处理文件代码? – Squashman