简体   繁体   中英

Cross compile with cmake for arm with static linked boost library

what I have:

  • a c++ project which uses the boost library
  • the project is build with cmake and links boost dynamically
  • a linux machine with x64
  • a dev board with an arm processor and linux

what I want:

One CMake project which does the follows:

  • one build for the x64 architecture (for gtest and local development)
  • another build for the arm architecture
  • both with static linked boost library

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. 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.

You can also just set Boost_LIBRARIES later in case the rest is equal.

To tell CMake to link Boost statically just set Boost_USE_STATIC_LIBS to ON .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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