CMake 不使用工具链文件

huangapple go评论100阅读模式
英文:

CMake does not use toolchain file

问题

  1. 我正在使用 ARM 工具链创建全新的 CMake 构建。
  2. 我运行了以下命令:
  3. cmake -DCMAKETOOLCHAINFILE=../arm-none-eabi-gcc.cmake -DCMAKE_BUILD_TYPE=Debug ../
  4. 即使在构建目录中没有缓存文件,输出如下:

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 警告:
项目未使用手动指定的变量:

  1. CMAKETOOLCHAINFILE

-- 构建文件已写入至: /home/alejandro/projects/ST-LIB/build

为什么 CMake 没有使用我的工具链文件?

我在库内的构建目录中运行 cmake 命令,因此 ../ 对于相对路径是正确的。

  1. <details>
  2. <summary>英文:</summary>
  3. I am creating an entirely new CMake build with the ARM toolchain.
  4. I ran the following command:
  5. cmake -DCMAKETOOLCHAINFILE=../arm-none-eabi-gcc.cmake -DCMAKE_BUILD_TYPE=Debug ../
  6. 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:

  1. CMAKETOOLCHAINFILE

-- Build files have been written to: /home/alejandro/projects/ST-LIB/build ```

  1. Why is CMake not using my toolchain file?
  2. I run the cmake command in the build directory inside my library, so ../ is correct for the relative path.
  3. </details>
  4. # 答案1
  5. **得分**: 2
  6. 你打错字了。应该是 [`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html)。
  7. <details>
  8. <summary>英文:</summary>
  9. You had a typo. It should be [`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html).
  10. </details>

huangapple
  • 本文由 发表于 2023年3月12日 16:50:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75711996.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定