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

Bjørn Forsman bjorn.forsman at gmail.com
Thu Dec 23 09:04:36 UTC 2010


Hi,

2010/12/22 Samuel Martin <s.martin49 at gmail.com>:
> Hi Bjørn,
>
>>
>> > In my version (not submitted), i also set the following
>>
>> > variables: CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH
>>
>> I just read up on those variables (man cmake) and it seems to me that they
>>
>> are used in addition to a default set of paths(?), which I presume are
>>
>> relative to CMAKE_FIND_ROOT_PATH. So are they really needed? What paths
>>
>> do you set them to?
>
> You're right.
> It might be an interesting point to add in the doc, but needs to be tested
> and confirmed.
> use case:
>   You build a BR environment, then an external lib out of BR and develop a
> project for the BR's target that use this external lib.
>   In this case, there are 2 solutions at least:
>     - add the external lib output directory path to the CMAKE_FIND_ROOT_PATH
> variable (need to alter the toolchain file)
>     - or set CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH pointed on the
> corresponding sub-directories of the external lib output directory.

Yes. Also, the toolchain file can be copied out of buildroot and
modified (if desired).

>> >> +       set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
>>
>> >
>>
>> > Here is the main point of disagreement. Because in BR the cross-compiler
>> > and
>>
>> > all tools around are located somewhere in a subdirectory of
>> > $(STAGING_DIR),
>>
>> > i do set CMAKE_FIND_ROOT_PATH_MODE_PROGRAM to "ONLY".
>>
>> Is it completely safe to set it to "ONLY"? Couldn't host binaries be
>> picked
>>
>> up during cross-compilation? Or am I missing something?
>
> When cross-compiling, you need to build the whole toolchain (ie. the
> cross-compiler, assembler, linker, and all useful cross-tools) and the
> sysroot for the target.
> You have to do this and only refer to these tools and sysroot when building
> binaries for the target to avoid building broken binaries that could
> be linked with something from the host.
> So, yes, for the target, i think it's safe to set it to "ONLY"

But is it necessary? Wouldn't "NEVER" suffice? I don't mean to be
difficult, but I'd like to see a real world example of when it is needed
and not just add it because it "also works".

Best regards,
Bjørn Forsman


More information about the buildroot mailing list