Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/4] Makefile: generate CMake toolchain file in $(O)
Date: Tue, 11 Jan 2011 11:22:28 +0100	[thread overview]
Message-ID: <20110111112228.263c00cb@surf> (raw)
In-Reply-To: <AANLkTimq86Kw6oCyacEhwE+YpcQa4H8etr49hCAyNz4y@mail.gmail.com>

Hello,

On Mon, 10 Jan 2011 19:30:16 +0100
Bj?rn Forsman <bjorn.forsman@gmail.com> wrote:

> Yes, I'll add that, thanks! I guess it only matters for the target
> build and not native build (we don't strip HOST_DIR do we?), but I
> think I'll add it to native build anyway, for consistency.

I had another two problems with the CMake toolchain file. The first is
that the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS variables were not taken
into account. It's more or less explained at
http://www.mail-archive.com/cmake at cmake.org/msg33248.html why this
happens. The second problem is that --sysroot was missing at link time,
so I had to add CMAKE_EXE_LINKER_FLAGS as well.

So I have the following changes:

diff --git a/Makefile b/Makefile
index 994dd52..b154007 100644
--- a/Makefile
+++ b/Makefile
@@ -378,8 +378,9 @@ $(O)/toolchainfile.cmake:
        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_C_FLAGS \"$(CMAKE_TARGET_CFLAGS)\" CACHE STRING \"\" FORCE)\n\
+       set(CMAKE_CXX_FLAGS \"$(CMAKE_TARGET_CXXFLAGS)\" CACHE STRING \"\" FORCE)\n\
+       set(CMAKE_EXE_LINKER_FLAGS \"$(CMAKE_TARGET_LDFLAGS)\" CACHE STRING \"\" FORCE)\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\
diff --git a/package/Makefile.cmake.in b/package/Makefile.cmake.in
index 08a0395..ce50b10 100644
--- a/package/Makefile.cmake.in
+++ b/package/Makefile.cmake.in
@@ -41,6 +41,7 @@ CMAKE_TARGET_CC = $(filter-out --sysroot=%,$(TARGET_CC))
 CMAKE_TARGET_CXX = $(filter-out --sysroot=%,$(TARGET_CXX))
 CMAKE_TARGET_CFLAGS = $(filter --sysroot=%,$(TARGET_CC)) $(TARGET_CFLAGS)
 CMAKE_TARGET_CXXFLAGS = $(filter --sysroot=%,$(TARGET_CXX)) $(TARGET_CXXFLAGS)
+CMAKE_TARGET_LDFLAGS = $(filter --sysroot=%,$(TARGET_LD)) $(TARGET_LDFLAGS)

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  parent reply	other threads:[~2011-01-11 10:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-12 19:29 [Buildroot] [PATCH 0/4] Introducing CMAKETARGETS infrastructure Bjørn Forsman
2010-12-12 19:29 ` [Buildroot] [PATCH 1/4] Add CMAKETARGETS infrastructure for CMake packages Bjørn Forsman
2010-12-13 22:27   ` Samuel Martin
2010-12-14 11:13     ` Bjørn Forsman
2010-12-22 21:34       ` Samuel Martin
2010-12-23  7:46         ` Thomas Petazzoni
2010-12-23  8:46           ` Bjørn Forsman
2010-12-23  8:54             ` Thomas Petazzoni
2010-12-23  9:14               ` Bjørn Forsman
2011-01-07 17:17   ` Thomas Petazzoni
2011-01-08 23:44     ` Bjørn Forsman
2011-01-10 17:51   ` Thomas Petazzoni
2011-01-10 20:14     ` Bjørn Forsman
2010-12-12 19:29 ` [Buildroot] [PATCH 2/4] doc: add CMAKETARGETS documentation Bjørn Forsman
2010-12-12 19:29 ` [Buildroot] [PATCH 3/4] Makefile: generate CMake toolchain file in $(O) Bjørn Forsman
2010-12-13 22:27   ` Samuel Martin
2010-12-14 12:39     ` Bjørn Forsman
2010-12-22 21:32       ` Samuel Martin
2010-12-23  7:48         ` Thomas Petazzoni
2010-12-24 12:25           ` Samuel Martin
2010-12-23  9:04         ` Bjørn Forsman
2010-12-24 12:26           ` Samuel Martin
2011-01-07 17:15   ` Thomas Petazzoni
2011-01-08 23:42     ` Bjørn Forsman
2011-01-09 12:52     ` Bjørn Forsman
2011-01-09 14:08       ` Thomas Petazzoni
2011-01-10 17:50     ` Thomas Petazzoni
2011-01-10 18:30       ` Bjørn Forsman
2011-01-10 22:28         ` Thomas Petazzoni
2011-01-11 10:22         ` Thomas Petazzoni [this message]
2011-01-11 10:27           ` Thomas Petazzoni
2011-01-15 13:50           ` Bjørn Forsman
2010-12-12 19:29 ` [Buildroot] [PATCH 4/4] cdrkit: convert to CMAKETARGETS infrastructure Bjørn Forsman
2010-12-13 22:28   ` Samuel Martin

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=20110111112228.263c00cb@surf \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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