[Buildroot] [PATCH 3/4] Makefile: generate CMake toolchain file in $(O)

Bjørn Forsman bjorn.forsman at gmail.com
Sun Jan 9 12:52:48 UTC 2011


Hi Thomas,

2011/1/7 Thomas Petazzoni <thomas.petazzoni at free-electrons.com>:
> Hello Bjorn,
>
> I finally had the time to try this, and got some issues, fixed by the
> below patch.
>
> On Sun, 12 Dec 2010 20:29:14 +0100
> Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
>
>> +$(O)/toolchainfile.cmake:
>> +     @echo -en "\
>> +     set(CMAKE_SYSTEM_NAME Linux)\n\
>> +     set(CMAKE_C_COMPILER $(CMAKE_TARGET_CC))\n\
>> +     set(CMAKE_CXX_COMPILER $(CMAKE_TARGET_CXX))\n\
>> +     set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))\n\
>> +     set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
>> +     set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
>> +     set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
>> +     " > $@
>>
>>  .PHONY: all world dirs clean distclean source outputmakefile \
>>       $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
>
> diff --git a/Makefile b/Makefile
> index 831b424..994dd52 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -375,8 +375,11 @@ world: prepare dependencies dirs $(BASE_TARGETS)
> $(TARGETS_ALL) $(O)/toolchainfile.cmake:
>        @echo -en "\
>        set(CMAKE_SYSTEM_NAME Linux)\n\
> +       set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)\n\
>        set(CMAKE_C_COMPILER $(CMAKE_TARGET_CC))\n\
>        set(CMAKE_CXX_COMPILER $(CMAKE_TARGET_CXX))\n\
> +       set(CMAKE_C_FLAGS \"$(CMAKE_TARGET_CFLAGS)\")\n\
> +       set(CMAKE_CXX_FLAGS \"$(CMAKE_TARGET_CXXFLAGS)\")\n\
>        set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))\n\
>        set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
>        set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
>
> With those, I can successfully use the CMake toolchain file to build a
> Qt application against the Buildroot libraries.

I assume that CMAKE_PROGRAM_PATH is needed so CMake can
find (at least) moc and/or qmake? But after a git pull + build moc
and qmake are not in HOST_DIR/usr/bin:

$ find -type f -name moc -o -name qmake
./output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/bin/moc
./output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/bin/qmake
[snip matches from ./output/build/qt-everywhere-opensource-src-4.7.1]

And if I let find follow symlinks I also get these additional matches:

./output/host/usr/arm-linux/sysroot/usr/bin/moc
./output/host/usr/arm-linux/sysroot/usr/bin/qmake
./output/staging/usr/bin/moc
./output/staging/usr/bin/qmake

Is this maybe caused by the recent toolchain/sysroot changes? Or is
qt.mk just installing to bad dir? I mean, moc and qmake are host
binaries so I think they should be in HOST_DIR/usr/bin and not in
(target) sysroot.

Any thoughts?

Best regards,
Bjørn Forsman



More information about the buildroot mailing list