[Buildroot] CMake building in a subdirectory

Angelo Compagnucci angelo.compagnucci at gmail.com
Thu Nov 6 21:15:37 UTC 2014


Hello list,

I encountered a problem making a new package based on CMake. For this
package, it's mandatory to build in a subdirectory inside src folder.
To compile it you have to do something like this:

cd src
mkdir build
cd build
cmake ..
make
make install

Honestly, it's a fairly common way to build with cmake, but it's
unsupported in buildroot. To make it work I changed this in
pkg-cmake.mk:

-$(2)_BUILDDIR                  = $$($(2)_SRCDIR)
+$(2)_BUILDDIR                  ?= $$($(2)_SRCDIR)

So, when you define LIBFOO_BUILDDIR in your .mk, cmake automatically
build in that subdirectory. This works like a charm!
Obviously, you have to mkdir that dir in LIBFOO_PRE_CONFIGURE_HOOKS.

I can submit a patch, but I would really like to know others opinions.

Sincerely, Angelo

-- 
Profile: http://it.linkedin.com/in/compagnucciangelo


More information about the buildroot mailing list