SET(ENV{PKG_CONFIG_SYSROOT_DIR} $FOO) doesn't work on the first run

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

SET(ENV{PKG_CONFIG_SYSROOT_DIR} $FOO) doesn't work on the first run

Antoine Villeret
Hello everyone, 

in my toolchain file I have :


then I run : 

cmake -DCMAKE_TOOLCHAIN_FILE=${PWD}/../of/dev/arm-linux-gnueabihf.cmake -DRPI_ROOT_PATH='/tmp/rpi/root' -DOF_PLATFORM=armv7 -G Ninja ../of

Environnement variable PKG_CONFIG_SYSROOT_DIR should then be filled with '/tmp/rpi/root'

But that doesn't work.

If I run `cmake` once again (with all of the arguments above), the environnement variable is correctly set.
I mean :


shows :


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.

Why SET method doesn't set the variable right on the first run ?

If I use :

    SET(ENV{PKG_CONFIG_SYSROOT_DIR} "/tmp/rpi/root")

everything works fine.

Moreover a very minimal CMakeLists.txt and toolchain.cmake works fine (see :

The original files are here : 

And I'm using CMake 3.5.2.

Where is my mistake ?




Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: