如何解决CMake从3.7.2更新到3.21.0后,try compile一个简单的测试程序坏了
我有一个工作 cmake (3.7.2) 和工具链文件,用于我的基于 gnu 的交叉编译器。 将cmake更新到3.21.0后无法编译简单的测试程序。
输出:
-- The C compiler identification is GNU 4.6.4
-- The CXX compiler identification is GNU 4.6.4
-- Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was: -f Makefile cmTC_79efc/fast &&
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: <compiler-root-path>/v4.6.6.1/bin/tricore-gcc.exe
CMake Error: Generator: execution of make failed. Make command was: -f Makefile cmTC_30bd9/fast &&
-- Check for working C compiler: <compiler-root-path>/v4.6.6.1/bin/tricore-gcc.exe - broken
CMake Error at <cmake-root-path>/cmake-3.21.0-windows-x86_64/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
'<compiler-root-path>/tricore/v4.6.6.1/bin/tricore-gcc.exe'
is not able to compile a simple test program.
It fails with the following output:
Change Dir: <source-root-path>/build/CMakeFiles/CMakeTmp
Run Build Command(s): -f Makefile cmTC_30bd9/fast && Falscher Parameter
Generator: execution of make failed. Make command was: -f Makefile cmTC_30bd9/fast &&
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (PROJECT)
-- Configuring incomplete,errors occurred!
See also '<source-root-path>/build/CMakeFiles/CMakeOutput.log'.
See also '<source-root-path>/build/CMakeFiles/CMakeError.log'.
make: *** No rule to make target `all'. Stop.
这个问题我找了好久都没找到解决办法。
我找到了一些几乎相同的解决方案,它们描述了如果 try_compile 不起作用该怎么办。
但是我有一个适用于 V3.7.2 的工作工具链文件(等等),但同样不适用于 V3.21.0。
此外,我还没有发现在更新时必须在工具链文件中更改某些内容。
感谢所有有用的答案。
解决方法
我发现了问题,在我的工具链文件中有一行SET(CMAKE_MAKE_PROGRAM "${COMPILER_ROOT_DIR}/bin/make.exe")
它必须是 SET(CMAKE_MAKE_PROGRAM "${COMPILER_ROOT_DIR}/bin/make.exe" CACHE INTERNAL "")
无论出于何种原因,第一个将在 V3.7.2 中工作,而不是在 V3.21.0 中。
第二个作品在两者中
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。