CMAKE 交叉编译
2015-12-02 02:12
267 查看
一般修改 CMAKE_SYSTEM_NAME, CMAKE_C_COMPILER
和 CMAKE_CXX_COMPILER 就够了。
比如,下面的一个 CMake 的 makefile文件:
########################################################################
# CMake build script for Google Mock.
#
# To run the tests for Google Mock itself on Linux, use 'make test' or
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER arm-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++)
#SET(CMAKE_FIND_ROOT_PATH /toolchain/arm-linux-4.8.2/arm-linux-gnueabi/sysroot)
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
option(gmock_build_tests "Build all of Google Mock's own tests." OFF)
# A directory to find Google Test sources.
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
set(gtest_dir gtest)
else()
set(gtest_dir ../googletest)
endif()
参考:
https://cmake.org/Wiki/CMake_Cross_Compiling
和 CMAKE_CXX_COMPILER 就够了。
比如,下面的一个 CMake 的 makefile文件:
########################################################################
# CMake build script for Google Mock.
#
# To run the tests for Google Mock itself on Linux, use 'make test' or
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER arm-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++)
#SET(CMAKE_FIND_ROOT_PATH /toolchain/arm-linux-4.8.2/arm-linux-gnueabi/sysroot)
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
option(gmock_build_tests "Build all of Google Mock's own tests." OFF)
# A directory to find Google Test sources.
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
set(gtest_dir gtest)
else()
set(gtest_dir ../googletest)
endif()
参考:
https://cmake.org/Wiki/CMake_Cross_Compiling
相关文章推荐
- cmake clion 构建cocos2dx 应用程序并编译ios mac android
- OpenCV配置,从来没有这么简单!
- MySQL CMake参数说明手册
- CMake 使用方法
- 用 cmake 构建Qt工程(对比qmake进行学习)
- CMake 手册详解(一)
- 一起学习CMake – 01
- 利用 CMake 和 NDK 交叉编译 Android 下的可执行程序
- MySQL 安装 CMake Error CMAKE_CXX_COMPILER not set
- MySQL5.5安装出现CMake错误找不到CMakelists.txt原因
- 在vc6中使用PCRE-8.33
- vs2012下编译protobuf
- 在Qtcreator下cmake工程文件及使用Qt制作PCL C++ GUI
- CMake生成VS2012 ARM project遇到的问题
- vs2013下openSIFT的编译调试
- 使用yum 使用 CentOS-6.5-x86_64-bin-DVD1.iso 作为本地源
- 安装Geant4的过程中学到的一些东西
- Linux下opencv的交叉编译
- mysql-5.5安装
- mysql-5.5安装