简体   繁体   English

与cmake交叉编译带有静态链接的Boost库的手臂

[英]Cross compile with cmake for arm with static linked boost library

what I have: 我有的:

  • a c++ project which uses the boost library 一个使用boost库的c ++项目
  • the project is build with cmake and links boost dynamically 该项目是使用cmake构建的,并且链接可以动态增强
  • a linux machine with x64 具有x64的linux机器
  • a dev board with an arm processor and linux 具有ARM处理器和Linux的开发板

what I want: 我想要的是:

One CMake project which does the follows: 一个CMake项目,它执行以下操作:

  • one build for the x64 architecture (for gtest and local development) 一种针对x64体系结构的构建(用于gtest和本地开发)
  • another build for the arm architecture 手臂架构的另一种构建
  • both with static linked boost library 两者都带有静态链接的Boost库

Is this possible, and if so, how? 这可能吗?如果可以,怎么办?

IMHO the main issue is to tell cmake, that for the second build it should use another (this time for arm) precompiled boost library to link. 恕我直言,主要问题是告诉cmake,对于第二个构建,它应该使用另一个(这次是arm)预编译的boost库进行链接。 No idea how to do. 不知道该怎么办。

Assumed that you use find_package(Boost ..) to search and select boost components (as you should) and if I get your question right you can just build in two different directories (as you most likely do already) and set CMake Variable BOOST_ROOT differently before configuring. 假设您使用find_package(Boost ..)搜索和选择增强组件(如您find_package(Boost ..) ),并且如果我正确地回答了问题,则可以仅在两个不同的目录中构建(您很可能已经这样做),并不同的方式设置CMake Variable BOOST_ROOT 配置之前

You can also just set Boost_LIBRARIES later in case the rest is equal. 您还可以稍后设置Boost_LIBRARIES ,以防其他情况相同。

To tell CMake to link Boost statically just set Boost_USE_STATIC_LIBS to ON . 要告诉CMake静态链接Boost,只需将Boost_USE_STATIC_LIBS设置为ON即可

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM