英文:
CMake does not use toolchain file
问题
我正在使用 ARM 工具链创建全新的 CMake 构建。
我运行了以下命令:
cmake -DCMAKETOOLCHAINFILE=../arm-none-eabi-gcc.cmake -DCMAKE_BUILD_TYPE=Debug ../
即使在构建目录中没有缓存文件,输出如下:
cmake -DCMAKETOOLCHAINFILE=../arm-none-eabi-gcc.cmake -DCMAKE_BUILD_TYPE=Debug ../
-- C 编译器标识为 GNU 11.3.0
-- CXX 编译器标识为 GNU 11.3.0
-- 检测 C 编译器 ABI 信息
-- 检测 C 编译器 ABI 信息 - 完成
-- 检查工作中的 C 编译器: /usr/bin/cc - 跳过
-- 检测 C 编译特性
-- 检测 C 编译特性 - 完成
-- 检测 CXX 编译器 ABI 信息
-- 检测 CXX 编译器 ABI 信息 - 完成
-- 检查工作中的 CXX 编译器: /usr/bin/c++ - 跳过
-- 检测 CXX 编译特性
-- 检测 CXX 编译特性 - 完成
-- 配置完成
-- 生成完成
CMake 警告:
项目未使用手动指定的变量:
CMAKETOOLCHAINFILE
-- 构建文件已写入至: /home/alejandro/projects/ST-LIB/build
为什么 CMake 没有使用我的工具链文件?
我在库内的构建目录中运行 cmake 命令,因此 ../ 对于相对路径是正确的。
<details>
<summary>英文:</summary>
I am creating an entirely new CMake build with the ARM toolchain.
I ran the following command:
cmake -DCMAKETOOLCHAINFILE=../arm-none-eabi-gcc.cmake -DCMAKE_BUILD_TYPE=Debug ../
Even though there are no cache files in the build directory, this is the output:
cmake -DCMAKETOOLCHAINFILE=../arm-none-eabi-gcc.cmake -DCMAKE_BUILD_TYPE=Debug ../
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMAKETOOLCHAINFILE
-- Build files have been written to: /home/alejandro/projects/ST-LIB/build ```
Why is CMake not using my toolchain file?
I run the cmake command in the build directory inside my library, so ../ is correct for the relative path.
</details>
# 答案1
**得分**: 2
你打错字了。应该是 [`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html)。
<details>
<summary>英文:</summary>
You had a typo. It should be [`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html).
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论