[CMake] Checking Variables in a tool-chain file

Shoaib Meenai smeenai at fb.com
Thu Jan 31 14:35:42 EST 2019


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 https://reviews.llvm.org/diffusion/L/browse/llvm/trunk/cmake/platforms/WinMsvc.cmake;352783$88-102?as=source&blame=off and the subsequent calls to init_user_prop.

On 1/31/19, 12:19 AM, "CMake on behalf of Torsten at Robitzki.de" <cmake-bounces at cmake.org on behalf of Torsten at Robitzki.de> wrote:

    Hi Sergei,
    
    > Am 31.01.2019 um 08:42 schrieb Sergei Nikulov <sergey.nikulov at gmail.com>:
    > 
    > Just guessing maybe better use $ENV{ARM_GCC_TOOL_PATH} ?
    > https://cmake.org/cmake/help/latest/variable/ENV.html?highlight=env
    
    Well, but this would mean, I had to configure CMake not only with Cache variables:
    
    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/ ..
    
    But also with environment variables:
    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/ ..
    
    Thanks for the pointer, I will think about it.
    
    kind regards,
    Torsten
    



More information about the CMake mailing list