Bug 6632 - CMake use host pkg-config
Summary: CMake use host pkg-config
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2013.02
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-30 09:46 UTC by Damien
Modified: 2013-10-30 10:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
cairo-dock.mk (644 bytes, application/octet-stream)
2013-10-30 10:11 UTC, Damien
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Damien 2013-10-30 09:46:47 UTC
Dear All,

I try to add cairo-dock in buildroot but I have a problem with CMAKE based package.

When I try to compile a CMAKE based package, cmake use the /usr/bin/pkg-config instead of the one compiled by buildroot.
So pkg-config look for package on host and not in buildroot directory.

Is there any solution to force cmake to use the correct pkg-config and find dependencies ?

Best regards
Comment 1 Thomas Petazzoni 2013-10-30 10:03:33 UTC
1/ Make sure your package depends on 'host-pkgconf', by doing something like <pkg>_DEPENDENCIES = host-pkgconf

2/ Make sure your package uses the cmake-package infrastructure, as described at http://buildroot.org/downloads/manual/manual.html#_infrastructure_for_cmake_based_packages. This will ensure that the directory where our cross pkg-config is installed is in the PATH, and before /usr/bin where the native pkg-config is.

Let us know if that fixes the problem for you.
Comment 2 Damien 2013-10-30 10:11:43 UTC
Created attachment 5108 [details]
cairo-dock.mk
Comment 3 Thomas Petazzoni 2013-10-30 10:29:15 UTC
What about something like:

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 0e08722..70014b5 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -62,7 +62,7 @@ ifeq ($(5),target)
 define $(2)_CONFIGURE_CMDS
        (cd $$($$(PKG)_BUILDDIR) && \
        rm -f CMakeCache.txt && \
-       $$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
+       $(TARGET_MAKE_ENV) $$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
                -DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
                -DCMAKE_INSTALL_PREFIX="/usr" \
                $$($$(PKG)_CONF_OPT) \
@@ -74,7 +74,7 @@ else
 define $(2)_CONFIGURE_CMDS
        (cd $$($$(PKG)_BUILDDIR) && \
        rm -f CMakeCache.txt && \
-       $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
+       $(HOST_MAKE_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
                -DCMAKE_INSTALL_SO_NO_EXE=0 \
                -DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \
                -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
Comment 4 Damien 2013-10-30 10:58:28 UTC
thanks a lot, it's work with your patch.