gcccmakecross-compiling

Cmake Error : referring to old revision even though upgraded to new revision


CMake Error: your C compiler: "/home/user/revision OLD/host/linux/x86/usr/bin/qcc" was not found.   
Please set CMAKE_C_COMPILER to a valid compiler path or name.

CMake Error: your CXX compiler: "/home/user/revision OLD/host/linux/x86/usr/bin/qcc" was not found.
Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

-- Configuring incomplete, errors occurred!
make: *** [cmake_check_build_system] Error 1

I changed my revision to new even though it refers to revision OLD path. I read on wiki FAQ they suggested like

$ cmake -G "Your Generator" -D CMAKE_C_COMPILER=gcc-4.2 -D CMAKE_CXX_COMPILER=g++-4.2 path/to/your/source

but is the right way to do it ? Because I heard that there are some downside like resets other FLAGS ?

I have no idea about cmake at all.


Solution

  • Yes, you can run cmake -DCMAKE_C_COMPILER=/new/revision/cc -DCMAKE_CXX_COMPILER=/new/revision/c++ . in your build dir. But this will cause CMake to do total reconfiguration, so you will lost your changes to default config.

    AFAIK, there is no way to prevent CMake from doing this, because it's done intentionally. CMake sets a lot of internal configuration vars based on selected compiler, and because of that it repeat it when you change the compiler.

    The only way to workaround this - make symlink to the compiler of the newer revision.