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

Bjørn Forsman bjorn.forsman at gmail.com
Tue Dec 14 12:39:12 UTC 2010


Hi Samuel,

2010/12/13 Samuel Martin <s.martin49 at gmail.com>:
> Hi Bjørn,
> Again, this reviews may refer to the other patch reviews of the set...
>>
>> +$(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\
>
> 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?

>>
>> +       set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))\n\
>>
>> +       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?

I haven't tested more than 'hello world' packages (no dependencies) with
the toolchain-file, so if having "ONLY" is mandatory for more complex
packages (like using pkg-config?) I'll change it.

>> +       set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
>>
>> +       set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
>>
>> +       " > $@
>
> The generated toolchain file does not seem to support external
>  cross-toolchain (btw, from my understanding, CTNG is installed in the
> staging, so no problem)
> To do that, I think CMAKE_FIND_ROOT_PATH is a list (so are
> CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH), so adjust them, CMAKE_C_COMPILER
> and CMAKE_CXX_COMPILER.

Did you test external toolchain? Did it break? I haven't tested it (yet),
but AFAIK Buildroot copies external toolchain's sysroot into staging so
there should no need for multiple entries in CMAKE_FIND_ROOT_PATH
(or changes to CMAKE_{C,CXX}_COMPILER). Right?

Best regards,
Bjørn Forsman



More information about the buildroot mailing list