CMAKE 交叉编译

来源:互联网 发布:windows virtual pc 编辑:程序博客网 时间:2024/05/18 01:25
一般修改 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

0 0
原创粉丝点击