我交叉编译了一个项目witch ccache:
cmake -G"Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=mips64el-toolchain.cmake
以下是mips64el-toolchain.cmake:
SET (CMAKE_SYSTEM_NAME Linux)
SET (CMAKE_SYSTEM_PROCESSOR mips64el)
SET (CMAKE_C_COMPILER ccache mips64el-n64-linux-gnu-gcc)
SET (CMAKE_CXX_COMPILER ccache mips64el-n64-linux-gnu-g++)
# here is the target environment located
SET (CMAKE_FIND_ROOT_PATH
$ENV{HOME}/x-tools/mips64el-n64-linux-gnu/mips64el-n64-linux-gnu/sysroot)
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
但我在 CMakeCache.txt 中发现了不正确的值:
CMAKE_AR:FILEPATH=/usr/bin/ar
CMAKE_STRIP:FILEPATH=/usr/bin/strip
ar 和 strip 不是交叉编译器。
如何正确设置它们?
一周前,我发现这是 cmake 的一个错误并修复了
- 模块/CMakeDetermineCCompiler.cmake
- 模块/CMakeDetermineCXXCompiler.cmake
有关详细信息,另请参阅