<div dir="ltr">Hello everyone, <div><br></div><div>in my toolchain file I have :</div><div><br></div><div>    SET(ENV{PKG_CONFIG_SYSROOT_DIR} "${RPI_ROOT_PATH}")</div><div><br></div><div>then I run : </div><div><br></div><div><div class="gmail_signature"><font color="#000000"><span style="white-space:pre-wrap">    cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../of/dev/arm-linux-gnueabihf.cmake -DRPI_ROOT_PATH='/tmp/rpi/root' -DOF_PLATFORM=armv7 -G Ninja ../of</span></font><span style="color:rgb(0,0,0);white-space:pre-wrap">
</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">Environnement variable </span><font color="#000000"><span style="white-space:pre-wrap">PKG_CONFIG_SYSROOT_DIR should then be filled with '</span></font><span style="color:rgb(0,0,0);white-space:pre-wrap">/tmp/rpi/root'</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">But that doesn't work.</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div><font color="#000000"><span style="white-space:pre-wrap">If I run `cmake` once again (with all of the arguments above), the environnement variable is correctly set.</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">I mean :</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">    message(STATUS "PKG_CONFIG_SYSROOT_DIR: " $ENV{PKG_CONFIG_SYSROOT_DIR})</span></font></div></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">shows : </span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">    PKG_CONFIG_SYSROOT_DIR: /tmp/rpi/root</span><br></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">which is correct, but since `pkg-config` has been run without that defined on the first run, the include and library paths are not updated and build failed.</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">Why SET method doesn't set the variable right on the first run ?</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">If I use :</span></font></div><div><br></div><div>    SET(ENV{PKG_CONFIG_SYSROOT_DIR} "/tmp/rpi/root")<br></div><div><br></div><div>everything works fine.</div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">Moreover a very minimal CMakeLists.txt and toolchain.cmake works fine (see : <a href="https://gist.github.com/avilleret/58ca1c9ba79cd203e16729ffe760ddc2">https://gist.github.com/avilleret/58ca1c9ba79cd203e16729ffe760ddc2</a></span></font><span style="white-space:pre-wrap;color:rgb(0,0,0)">).</span></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div>The original files are here : </div><div><a href="https://github.com/ofnode/of/blob/feature/rpiCrossCompiling/CMakeLists.txt">https://github.com/ofnode/of/blob/feature/rpiCrossCompiling/CMakeLists.txt</a></div><div>and </div><div><a href="https://github.com/ofnode/of/blob/feature/rpiCrossCompiling/dev/arm-linux-gnueabihf.cmake">https://github.com/ofnode/of/blob/feature/rpiCrossCompiling/dev/arm-linux-gnueabihf.cmake</a></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">And I'm using CMake 3.5.2.</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">Where is my mistake ?</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">Regards</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">Antoine</span></font></div></div>