I'm currently trying to use CMake for cross-compiling. However, CMake seems to ignore the toolchain specified by
cmake -DCMAKE_TOOLCHAIN_FILE=my-toolchain.cmake .
or
cmake . -DCMAKE_TOOLCHAIN_FILE=my-toolchain.cmake
If I omit the CMAKE_TOOLCHAIN_FILE option, the exact same Makefile is generated. Furthermore, if I deliberately give a wrong filename or insert syntax and path errors in the toolchain file, CMake doesn't bother to complain either.
Is there a way to get more error/debug output during a CMake run? The only option I could find is "--debug-output", which isn't very helpful in my case.
CMake uses a toolchain of utilities to compile, link libraries and create archives, and other tasks to drive the build. The toolchain utilities available are determined by the languages enabled. In normal builds, CMake automatically determines the toolchain for host builds based on system introspection and defaults.
The CMAKE_SYSROOT content is passed to the compiler in the --sysroot flag, if supported. The path is also stripped from the RPATH / RUNPATH if necessary on installation. The CMAKE_SYSROOT is also used to prefix paths searched by the find_* commands.
My mistake. CMake always regenerated an existing build tree. By deleting CMakeCache.txt in the build directory, CMake is forced to generate a new build tree and does not ignore the CMAKE_TOOLCHAIN_FILE option anymore. See the CMake FAQ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With