Hello everyone,

in my toolchain file I have :

    SET(ENV{PKG_CONFIG_SYSROOT_DIR} "${RPI_ROOT_PATH}")

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 :

message(STATUS "PKG_CONFIG_SYSROOT_DIR: " $ENV{PKG_CONFIG_SYSROOT_DIR})

shows :

PKG_CONFIG_SYSROOT_DIR: /tmp/rpi/root

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
: https://gist.github.com/avilleret/58ca1c9ba79cd203e16729ffe760ddc2).

The original files are here :
https://github.com/ofnode/of/blob/feature/rpiCrossCompiling/CMakeLists.txt
and
https://github.com/ofnode/of/blob/feature/rpiCrossCompiling/dev/arm-linux-gnueabihf.cmake

And I'm using CMake 3.5.2.

Where is my mistake ?

Regards

Antoine
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to