cmake - How to use different tool chains -
in project targets build , run on build platform , other targets build cross platform; options have, when using cmake?
currently use cmake_build_type
define tool chain, build type , platform (for example -d cmake_build_type=arm_debug
). in 1 place in build, switch tools (compilers, linke etc.), command line flags, libraries etc. according value of cmake_build_type. every build type, create build directory.
this approach has it's drawbacks: multiple build directories , no easy way depend 1 target 1 build type on target in other build type (some kind of precompiler needed on build platform build cross platform example).
as every build targets has single tool chain used love associate target target platform / tools set. implies libraries have build more 1 target platform different tool sets.
the 'one build type , platform per cmake run' limitation fundamental , advise against trying work around it.
the proper solution here seems me split build several stages. in particular, scenario target 1 build type depends on target build type, should not try have 2 targets in same cmake project. proper modularization key here. effective use of cmake's include
command can avoid code duplication in build scripts.
the big drawback of approach build process becomes more complex, have several interdependent cmake projects need built in order specific configurations. although seem way beyond point can build whole system single command anyway. cmake can manage complexity tools externalproject
, allows build cmake project within another. depending on particular setup, non-cmake layer written in favorite scripting language might viable alternative ensuring different subprojects built in correct order.
the sad truth though complex build setups hard manage. cmake great job @ providing number of tools tackling complexity cannot magically make problem easier. of limitations cmake imposes on user there reason, namely things even harder if tried work without them.
Comments
Post a Comment