Search code examples
cmakecross-compilingupdates

After CMake update from 3.7.2 to 3.21.0, the try compile a simple test program is broken


I have a working cmake (3.7.2) with toolchain file for my gnu based cross-compiler. After update cmake to 3.21.0 it is not able to compile a simple test program.

Output:

-- 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.

I have search a long time for this problem, but i don't find a solution.
I have found some solution which are nearly the same, they describe what is to do if try_compile will not work.
But I have a working toolchain-file (and so on) for V3.7.2 but the same will not work with V3.21.0.
Also i have not found that something must be changed at the toolchain-file while updateing.

Thanks for all helpful answers.


Solution

  • I found the problem, in my toolchain-file there is the line
    SET(CMAKE_MAKE_PROGRAM "${COMPILER_ROOT_DIR}/bin/make.exe")
    and it must be
    SET(CMAKE_MAKE_PROGRAM "${COMPILER_ROOT_DIR}/bin/make.exe" CACHE INTERNAL "")
    For whatever reason the first one will work in V3.7.2 and not in V3.21.0.
    The second works in both