Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
To: Pascal Bach <pascal.bach@siemens.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] cmake.bbclass: set archiver, linker and ranlib in toolchain.cmake
Date: Fri, 17 Jul 2015 12:56:24 +0200	[thread overview]
Message-ID: <55A8DF58.4010906@herbrechtsmeier.net> (raw)
In-Reply-To: <1437119073-4788-1-git-send-email-pascal.bach@siemens.com>

Am 17.07.2015 um 09:44 schrieb Pascal Bach:
> Setting CMAKE_AR, CMAKE_LINKER and CMAKE_RANLIB correctly in
> toolchain.cmake is necessary to correctly build -native packages
> using CMake.
>
> The reason is that CMake is not able to find the above utilities by
> itself because CMAKE_FIND_ROOT_PATH_MODE_PROGRAM is set to ONLY
> so we need to tell it explicitly where to look.
Which version do you use? The master sets 
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM to BOTH for native packages.

If this don't work you could set the CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN 
path (without /bin).

> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> ---
>   meta/classes/cmake.bbclass | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index 995ddf1..cae0ad2 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -13,6 +13,9 @@ inherit autotools
>   # C/C++ Compiler (without cpu arch/tune arguments)
>   OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`"
>   OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`"
> +OECMAKE_AR ?= "`echo ${AR} | sed 's/^\([^ ]*\).*/\1/'`"
This is already set in master.

> +OECMAKE_LINKER ?= "`echo ${LD} | sed 's/^\([^ ]*\).*/\1/'`"
> +OECMAKE_RANLIB ?= "`echo ${RANLIB} | sed 's/^\([^ ]*\).*/\1/'`"
You don't need the sed for ranlib.

>   # Compiler flags
>   OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
> @@ -35,6 +38,11 @@ set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} )
>   set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
>   set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
>   set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
> +# Force the use of cache here otherwise the values will be overridden (http://www.cmake.org/Bug/view.php?id=13038)
> +set( CMAKE_AR ar CACHE FILEPATH "Archiver" FORCE )
> +set( CMAKE_LINKER ld CACHE FILEPATH "Linker" FORCE )
> +set( CMAKE_RANLIB ranlib CACHE FILEPATH "Ranlib" FORCE )
> +
Why you generate OECMAKE_* and don't use them?

Furthermore the CMAKE_* should contain the full path and are generated 
in the CMakeFindBinUtils.cmake.

>   set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
>   set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
>   set( CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )



  reply	other threads:[~2015-07-17 10:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17  7:44 [PATCH] cmake.bbclass: set archiver, linker and ranlib in toolchain.cmake Pascal Bach
2015-07-17 10:56 ` Stefan Herbrechtsmeier [this message]
2015-07-17 12:23   ` Bach, Pascal
2015-07-17 13:23     ` Stefan Herbrechtsmeier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55A8DF58.4010906@herbrechtsmeier.net \
    --to=stefan@herbrechtsmeier.net \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pascal.bach@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox