<div dir="ltr"><div><div><div><div><div><div><div><div><div>In VTK and ParaView we use a manual two-step build.  The first pass configures a host build of the cross-compile utilities and the second pass configures a target build with a toolchain file, which requires you tell it where the host tools are.  So the build process looks like this:<br><span style="font-family:monospace,monospace"><br></span></div><span style="font-family:monospace,monospace">mkdir build_host<br></span></div><span style="font-family:monospace,monospace">cd build_host</span></div><span style="font-family:monospace,monospace">cmake -DBUILD_CROSSTOOLS=ON /path/to/source<br></span></div><span style="font-family:monospace,monospace">make<br></span></div><span style="font-family:monospace,monospace">cd ..<br></span></div><span style="font-family:monospace,monospace">mkdir build_target<br></span></div><span style="font-family:monospace,monospace">cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/tolchain.cmake -DFOO_CROSSTOOLS_DIR=/path/to/build_host<br></span></div><span style="font-family:monospace,monospace">make<br></span><br></div>You should be able to adapt this to a superbuild scenario with two external projects and it seems like that's exactly what you've done.  Just confirming that yes that's a sane approach and that's how we do it to.<br><br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">----------<br>Chuck Atkins<br>Staff R&D Engineer, Scientific Computing<br>Kitware, Inc.<br><br></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Oct 10, 2016 at 9:56 AM, Robert Bielik <span dir="ltr"><<a href="mailto:Robert.Bielik@dirac.com" target="_blank">Robert.Bielik@dirac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="blue" vlink="purple" lang="SV">
<div>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">For reference: I went with Brads suggestion:
<a href="https://gitlab.kitware.com/cmake/cmake/issues/16356" target="_blank">https://gitlab.kitware.com/<wbr>cmake/cmake/issues/16356</a><u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">which seems to be working fine.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">Regards<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">/R<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"><u></u> <u></u></span></font></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;font-weight:bold" lang="EN-US">From:</span></font></b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">
 CMake [mailto:<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.<wbr>org</a>] <b><span style="font-weight:bold">On Behalf Of
</span></b>Robert Bielik<br>
<b><span style="font-weight:bold">Sent:</span></b> den 10 oktober 2016 14:00<br>
<b><span style="font-weight:bold">To:</span></b> Craig Scott <<a href="mailto:craig.scott@crascit.com" target="_blank">craig.scott@crascit.com</a>></span></font></p><div><div class="h5"><font size="2" face="Calibri"><br>
<b><span style="font-weight:bold">Cc:</span></b> <a href="mailto:Cmake@cmake.org" target="_blank">Cmake@cmake.org</a><br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [CMake] Crosscompilation woes<u></u><u></u></font></div></div><p></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">I am using a toolchain file! The CC and CXX environment variables are set by CMake (I assume, because
 I haven’t touched them).<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">I’ll disect the link to see what I’ve missed.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">Regards<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">/R<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"><u></u> <u></u></span></font></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;font-weight:bold" lang="EN-US">From:</span></font></b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">
 Craig Scott [<a href="mailto:craig.scott@crascit.com" target="_blank">mailto:craig.scott@crascit.<wbr>com</a>]
<br>
<b><span style="font-weight:bold">Sent:</span></b> den 10 oktober 2016 13:56<br>
<b><span style="font-weight:bold">To:</span></b> Robert Bielik <<a href="mailto:Robert.Bielik@dirac.com" target="_blank">Robert.Bielik@dirac.com</a>><br>
<b><span style="font-weight:bold">Cc:</span></b> <a href="mailto:Cmake@cmake.org" target="_blank">
Cmake@cmake.org</a><br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [CMake] Crosscompilation woes<u></u><u></u></span></font></p>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"><u></u> <u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Don't use environment variables to set the ARM compilers in your situation, use a toolchain file to specify them instead. Your CMake experience will generally be smoother
 if you specify cross-compile details via toolchain files. If you are following the method in the stackoverflow link I mentioned last time, the host part of the build will then pick up the host compilers and the ARM part of the build will use the compilers
 from the toolchain file.<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">On Mon, Oct 10, 2016 at 10:50 PM, Robert Bielik <<a href="mailto:Robert.Bielik@dirac.com" target="_blank">Robert.Bielik@dirac.com</a>> wrote:<u></u><u></u></span></font></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">I’m trying to do this, but since I setup a cross compiling env. by setting
 C&C++ compiler, these settings get used when I run execute_process to setup the host build !! Thus I get the ARM version of the build tools anyway! :(</span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">It seems that when execute_process is executed, the CC and CXX environment
 variables are set, which makes cmake use those when generating the makefiles.</span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">Ideas are most welcome!</span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">Regards</span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">/R</span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> </span></font><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;font-weight:bold" lang="EN-US">From:</span></font></b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">
 Craig Scott [mailto:<a href="mailto:craig.scott@crascit.com" target="_blank">craig.scott@crascit.<wbr>com</a>]
<br>
<b><span style="font-weight:bold">Sent:</span></b> den 10 oktober 2016 10:47<br>
<b><span style="font-weight:bold">To:</span></b> Robert Bielik <<a href="mailto:Robert.Bielik@dirac.com" target="_blank">Robert.Bielik@dirac.com</a>><br>
<b><span style="font-weight:bold">Cc:</span></b> <a href="mailto:Cmake@cmake.org" target="_blank">
Cmake@cmake.org</a><br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [CMake] Crosscompilation woes</span></font><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"> </span><u></u><u></u></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US">Here's one possible solution (not perfect, but has been working in production for us for a while
 now for a similar scenario to what you describe):</span><u></u><u></u></font></p>
<div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"> </span><u></u><u></u></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><a href="http://stackoverflow.com/q/36084785/1938798" target="_blank"><span lang="EN-US">http://stackoverflow.com/q/<wbr>36084785/1938798</span></a><u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"> </span><u></u><u></u></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US">An alternative is a superbuild arrangement which would require a top level project to drive two
 sub-builds brought in via </span><a href="https://cmake.org/cmake/help/latest/module/ExternalProject.html" target="_blank"><span lang="EN-US">ExternalProject</span></a></font><span lang="EN-US">, one for the host and the other for arm. This is both better
 and worse, depending on your point of view, so you may need to do some research/experimenting to see which is a better fit for your situation.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"> </span><u></u><u></u></font></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"> </span><u></u><u></u></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US">On Mon, Oct 10, 2016 at 7:29 PM, Robert Bielik <</span><a href="mailto:Robert.Bielik@dirac.com" target="_blank"><span lang="EN-US">Robert.Bielik@dirac.com</span></a></font><span lang="EN-US">>
 wrote:</span><u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US">Hi all,<br>
<br>
I am crosscompiling a project for arm (on linux i686), and use codegeneration tools within the project (together with add_custom_command). Of course, this will fail, since the tools are compiled for arm also and thus won't execute on my host system. So the
 tools need to be compiled for i686 whilst the rest for arm. I'm sure this can be handled by CMake although haven't done it before so would appreciate pointers :)<br>
<br>
Regards<br>
/Robert<br>
<br>
--<br>
<br>
Powered by </span><a href="http://www.kitware.com" target="_blank"><span lang="EN-US">www.kitware.com</span></a></font><span lang="EN-US"><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: </span><a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank"><span lang="EN-US">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</span></a><span lang="EN-US"><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: </span><a href="http://cmake.org/cmake/help/support.html" target="_blank"><span lang="EN-US">http://cmake.org/cmake/help/<wbr>support.html</span></a><span lang="EN-US"><br>
CMake Consulting: </span><a href="http://cmake.org/cmake/help/consulting.html" target="_blank"><span lang="EN-US">http://cmake.org/cmake/help/<wbr>consulting.html</span></a><span lang="EN-US"><br>
CMake Training Courses: </span><a href="http://cmake.org/cmake/help/training.html" target="_blank"><span lang="EN-US">http://cmake.org/cmake/help/<wbr>training.html</span></a><span lang="EN-US"><br>
<br>
Visit other Kitware open-source projects at </span><a href="http://www.kitware.com/opensource/opensource.html" target="_blank"><span lang="EN-US">http://www.kitware.com/<wbr>opensource/opensource.html</span></a><span lang="EN-US"><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
</span><a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank"><span lang="EN-US">http://public.kitware.com/<wbr>mailman/listinfo/cmake</span></a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"><br>
<br clear="all">
</span><u></u><u></u></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US"> </span><u></u><u></u></font></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US">--
</span><u></u><u></u></font></p>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US">Craig Scott</span><u></u><u></u></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt" lang="EN-US">Melbourne, Australia</span><u></u><u></u></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><a href="https://crascit.com" target="_blank"><span lang="EN-US">https://crascit.com</span></a><u></u><u></u></span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
<br clear="all">
<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">--
<u></u><u></u></span></font></p>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Craig Scott<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Melbourne, Australia<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><a href="https://crascit.com" target="_blank">https://crascit.com</a><u></u><u></u></span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>

<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br></blockquote></div><br></div></div>