cmake: pass HOST_CONFIGURE_OPTS at configure time
commit0904b80b47245cf85d414f78c381b9cf61c6ef4b
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 3 Dec 2016 15:24:23 +0000 (3 16:24 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 3 Dec 2016 15:24:23 +0000 (3 16:24 +0100)
tree66d27e9050707fd1b69110b3c3c87802fe8457c4
parent7fe6b5d9dc88708ba5141ef5c8aa923a6ae54339
cmake: pass HOST_CONFIGURE_OPTS at configure time

Since we bumped CMake from 3.5.2 to 3.6.3 in commit
99ed85d74081a8611a6f6d1f3d745a5c40aef975, CMake uses pkg-config during
its configure step to find available libraries on the host.

If host-pkgconf was not built before host-cmake, everything was working
fine. However, if host-pkgconf was built before, the configure step of
host-cmake was finding pkg-config and used it to find
libraries. Unfortunately, since we were not passing
PKG_CONFIG_PATH/PKG_CONFIG_SYSROOT_DIR, pkg-config was behaving in its
"default" mode, i.e returning results valid when building things for the
target, not for the host. This lead to header paths pointing to the
staging directory being used when building native binary objects,
causing all sort of build failures.

This commit fixes that by passing $(HOST_CONFIGURE_OPTS) to the
environment of host-cmake configure step. This variable contains
HOST_MAKE_ENV, which itself contains the appropriate
PKG_CONFIG_PATH/PKG_CONFIG_SYSROOT_DIR definitions.

At the same time, we drop LDFLAGS="$(HOST_LDFLAGS)" because this
definition is already in $(HOST_CONFIGURE_OPTS).

Fixes:

  http://autobuild.buildroot.net/results/4e703ed8c2eb0f914794038b0ef7bd73a67f38ce/
  (and 424 similar build failures)

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/cmake/cmake.mk