在windows上,用cmake 交叉编译arm程序。生成器用nijia(或用MinGW,此时, cmake执行时,指定生成器为 -G “MinGW Makefiles”, 编译用make).

CMakeLists.txt

cmake_minimum_required(VERSION 3.6)project(testApp)file(WRITE main.cpp "int main(void) { return 0; }")set(testApp "testApp")list(APPEND testApp_sourcesmain.cpp
)add_executable(${testApp}${testApp_sources}
)

toolchain.cmake


set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)set(CMAKE_C_COMPILER "arm-none-eabi-gcc.exe")
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++.exe")set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs" CACHE INTERNAL "")set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

在cmd 执行

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE:PATH="..\toolchain.cmake" ..-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc.exe
-- Check for working C compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-g++.exe
-- Check for working CXX compiler: D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/work/clip/code/test/build

编译

>ninja
[2/2] Linking CXX executable testApp

说下遇到的问题,出现以下错误:

D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gccis not a full path to an existing compiler tool.Tell CMake where to find the compiler by setting either the environmentvariable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path tothe compiler, or to the compiler name if it is in the PATH.

原因是在window下,要把后缀也写上。下面是不行的。

set(CMAKE_C_COMPILER "D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc")

改成

set(CMAKE_C_COMPILER "D:/sigmastar/flythings/sdk/platforms/ssd/toolchain/bin/arm-pc-linux-gnueabihf-gcc.exe")

您的支持是我持续创作的动力!

在windows上,用cmake 交叉编译arm程序相关推荐

  1. linux使用cmake交叉编译arm32程序

    linux使用cmake交叉编译arm32程序 如需转载请标明出处:http://blog.csdn.net/itas109 QQ技术交流群:129518033 文章目录 linux使用cmake交叉 ...

  2. 脱离AS在windows下使用CMake交叉编译for Android

    脱离AS在windows下使用CMake交叉编译for Android 前言 可能有Android开发经验并搞过jni的撸友知道,使用Android ndk 中的ndk-build 结合Android ...

  3. 在windows上配置VScode支持ARM GCC开发环境

    简单有效的在windows上,配置VS Code,以支持GCC开发环境.没有什么花里胡哨的. 需要用到的工具 Visual Studio Code :编辑工具 ARM GCC :            ...

  4. 使用Rust交叉编译arm程序

    作者: 刘天明 邮箱: bellskinling@gmail.com 博客链接: http://blog.csdn.net/bellskinling 转载请注明出处. 接上文, 有了支持arm版本的R ...

  5. Windows上使用ionic开发IOS程序

    开发ios程序需要mac本,但是好多屌丝们没有Mac 本,那就在虚拟机上安装一个MacOS,凑合着用吧. 下面我就以我自己的亲身经历,带着ionic爱好者一步一步的在windows上开发ios程序 安 ...

  6. ming window 交叉编译_如何在Linux for Windows上与MinGW交叉编译?

    我正在尝试使用MinGW在 Linux上编译Windows的Qt5应用程序. 我正在使用Travis-CI来获得两个Windows可执行文件(win32,win64)的连续构建. 我已经建立了一个构建 ...

  7. Windows上使用C#控制台应用程序打开指定路径的文件

    例如打开Windows操作系统里的cmd.exe(命令行程序) using System; using System.Collections.Generic; using System.Linq; u ...

  8. java fx 内置图标_图标 – 如何在Windows上为javafx本机程序包图标设置自定义图标...

    我正在尝试创建exe文件的图标,同时创建javafx包装的本机捆绑. 我尝试将图标添加到pom.xml中,但直到它不会为我工作,因为它提供了默认图标 使用包含Pom.xml的Intellij IDEA ...

  9. cygwin安装好了如何添加cmake make_在windows上使用cmake

    安装 下载cmake,官网地址:https://cmake.org/download/, 推荐Binary distributions的对于版本.msi. 双击安装到对应路径,将 bin 的路径添加到 ...

最新文章

  1. golang install/build 生成的文件命名和路径
  2. html实战例子: 课程表
  3. java类名变量_java类名操作变量方法
  4. RabbitMQ非root用户安装(Linux环境)
  5. C++ opengl 绘制三角形带
  6. Ubuntu: 创建PlayOnLinux快捷键 Create PlayOnLinux Application Desktop
  7. 分布式文件系统之MogileFS的使用
  8. 【转】JavaScript中的匿名函数及函数的闭包
  9. @Pathvariable的参数允许为空的问题的解决
  10. python中的return函数-python中return的返回和执行
  11. [转载] python函数isdisjoint方法_Python中的isdisjoint()函数
  12. MySQL下载安装、配置与使用(win7x64)
  13. MIUI 12稳定版系统中的开发者选项限制解除
  14. SpringBoot-缓存Ehcache的使用
  15. Android O (8.0) 新特性介绍
  16. 独木舟上的旅行java_南阳ACM 题目71:独木舟上的旅行 Java版
  17. 读《王二的经济学故事》
  18. 求矩形槽内电位分布matlab,MATLAB超松弛迭代法求解接地金属槽内电位分布
  19. latex写加上标题不显示页眉页脚
  20. 《手摸手带你学ClickHouse》之Oracle同步数据到Clickhouse

热门文章

  1. Go语言开发工程师一定要熟读的5个开源项目
  2. spring 异步发送短信
  3. HTML和CSS简单整理
  4. 【Kettle】学习笔记
  5. Python数据(个人所需)
  6. 2020.06新闻文章回顾
  7. 08_ue4进阶_开始结束暂停菜单等ui
  8. 浅析企业ERP系统运维体系的建立
  9. lora 与 485 双线备份式通讯
  10. 游戏UI框架设计(四) : 模态窗体管理