It does not happen automatically, but it is not hard to pass down the tool chain as an additional parameter to the configure step of your external projects. There may be other adjustments necessary, too. I'm not sure, I still haven't done a lot of cross-compiling myself with CMake yet.
Cross-compiling came after ExternalProject, took a long time to stabilize into something useful, and only works with certain generators... I guess it makes sense that you'd mostly want to use the toolchain for ExternalProjects. Perhaps it's time for a patch. ;-) The focus with ExternalProject when it was first built was actually to enable building any project, even ones that don't use CMake to drive their builds. The decision was made early on NOT to pass down most CMake settings, so the developer writing the ExternalProject_Add call is the one deciding what needs to be passed down. (Consider, for example, the case of building a set of libraries, both Debug and Release, both Static and Shared, for many architectures, all as part of one overarching superbuild. Passing all those settings down from the parent might make that sort of thing difficult or confusing.) Anyhow, the short answer was, no, CMake doesn't do it automatically. You'll have to do it yourself. I'd recommend having a top level "extra CMake parameters" variable that gets passed to all your ExternalProject_Add calls. HTH, David C. On Friday, March 6, 2015, Richard Shaw <[email protected]> wrote: > I've got a cmake based project that can optionally build static versions > of most of its dependencies and it works fine on Linux and MSYS2+MinGW. > > The problem is when I try to cross compile using MinGW on Linux. I would > expect cmake would be smart enough to know if the parent project is being > built with a particular toolchain that the external projects (also cmake > based) would use the same toolchain but that doesn't appear to be what's > happening. > > Is there some setting I'm missing here? > > I'm currently running 3.0.2 on Fedora linux but this has been happening on > 2.8.X as well. > > Thanks, > Richard >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
