【问题标题】:CMake: how to properly setup new toolchain to avoid "System is unknown to CMake" message?CMake:如何正确设置新工具链以避免“CMake 未知系统”消息?
【发布时间】:2014-09-14 11:39:39
【问题描述】:

我已经设置了一个新的 CMake 工具链文件来交叉编译 STxP70 处理器。我将文件放在我的工作目录中,然后使用以下命令调用 cmake:

$ cmake -DCMAKE_TOOLCHAIN_FILE=STxP70_toolchain.cmake ...

它工作正常,但我总是收到一条消息:

System is unknown to cmake, create:
Platform/STxP70 to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake

有没有办法将工具链文件放在本地某个地方,以便 CMake 能够识别它并且不会抱怨系统未知?我似乎在任何地方都找不到它。

提前致谢。

【问题讨论】:

    标签: cmake cross-compiling


    【解决方案1】:

    您的工具链文件 STxP70_toolchain.cmake 被 CMake 正确找到,否则您会看到如下消息:

    Could not find toolchain file: STxP70_toolchain.cmake
    

    您看到的消息来自设置变量CMAKE_SYSTEM_NAME,例如命令

    cmake .. -DCMAKE_SYSTEM_NAME="BLAH"
    

    产生消息:

    System is unknown to cmake, create:
    Platform/BLAH to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake
    

    Documentation 状态:

    CMAKE_SYSTEM_NAME:

    这个是必填的,是目标的名字 系统,即与 CMake 的 CMAKE_SYSTEM_NAME 相同 在目标系统上运行。典型的例子是“Linux”和“Windows”。 该变量用于构造平台的文件名 Linux.cmake 或 Windows-gcc.cmake 等文件。如果您的目标是 没有操作系统的嵌入式系统将 CMAKE_SYSTEM_NAME 设置为“通用”。如果 CMAKE_SYSTEM_NAME 是预设的,CMake 变量 CMAKE_CROSSCOMPILING 自动设置为 TRUE,因此这可用于在 CMake 文件。

    您可以将CMAKE_SYSTEM_NAME 设置为Generic 以禁用警告说STxP70.cmake 不存在于CMake 分发目录install\path\to\CMake\share\cmake-2.8\Modules\Platform\

    【讨论】:

    • CMAKE_SYSTEM_NAME 设置为Generic 有效地消除了警告。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2013-02-17
    • 2022-06-22
    • 1970-01-01
    • 1970-01-01
    • 2021-01-30
    • 2016-10-23
    • 2020-12-20
    • 1970-01-01
    相关资源
    最近更新 更多