<div dir="ltr"><div>This is precisely the scenario that the <a href="https://cmake.org/cmake/help/latest/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.html">CMAKE_TRY_COMPILE_PLATFORM_VARIABLES</a> variable is meant for. It allows a toolchain file to specify additional variables that should be passed along to try_compile().</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 1, 2019 at 6:36 AM Shoaib Meenai <<a href="mailto:smeenai@fb.com">smeenai@fb.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">We have a somewhat similar problem with LLVM's toolchain file for cross-compiling to Windows, and we solve it there by saving and restoring cache variables from the environment inside the toolchain file itself. See <a href="https://reviews.llvm.org/diffusion/L/browse/llvm/trunk/cmake/platforms/WinMsvc.cmake;352783$88-102?as=source&blame=off" rel="noreferrer" target="_blank">https://reviews.llvm.org/diffusion/L/browse/llvm/trunk/cmake/platforms/WinMsvc.cmake;352783$88-102?as=source&blame=off</a> and the subsequent calls to init_user_prop.<br>
<br>
On 1/31/19, 12:19 AM, "CMake on behalf of Torsten@Robitzki.de" <<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a> on behalf of Torsten@Robitzki.de> wrote:<br>
<br>
Hi Sergei,<br>
<br>
> Am 31.01.2019 um 08:42 schrieb Sergei Nikulov <<a href="mailto:sergey.nikulov@gmail.com" target="_blank">sergey.nikulov@gmail.com</a>>:<br>
> <br>
> Just guessing maybe better use $ENV{ARM_GCC_TOOL_PATH} ?<br>
> <a href="https://cmake.org/cmake/help/latest/variable/ENV.html?highlight=env" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/latest/variable/ENV.html?highlight=env</a><br>
<br>
Well, but this would mean, I had to configure CMake not only with Cache variables:<br>
<br>
cmake -DARM_GCC_TOOL_PATH=/usr/local/gcc-arm-none-eabi-7-2018-q2-update -DBINDING=nrf52 -DCMAKE_TOOLCHAIN_FILE=../cmake/gcc-arm-none-eabi.cmake -DNRF5_SDK_ROOT=~/CMSIS/nRF5_SDK_14-2/ ..<br>
<br>
But also with environment variables:<br>
ARM_GCC_TOOL_PATH=/usr/local/gcc-arm-none-eabi-7-2018-q2-update cmake -DBINDING=nrf52 -DCMAKE_TOOLCHAIN_FILE=../cmake/gcc-arm-none-eabi.cmake -DNRF5_SDK_ROOT=~/CMSIS/nRF5_SDK_14-2/ ..<br>
<br>
Thanks for the pointer, I will think about it.<br>
<br>
kind regards,<br>
Torsten<br></blockquote><div> </div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>Get the hand-book for every CMake user: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>