Patchwork [11/16] cmake.bbclass: Add OECMAKE_C_LINK_FLAGS and OECMAKE_CXX_LINK_FLAGS variables

login
register
mail settings
Submitter Khem Raj
Date June 9, 2012, 4:43 p.m.
Message ID <e85710255addf84bd1e2028cb8986650c15de7ef.1339259893.git.raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/29577/
State Accepted
Commit 9e00a74749ba8e1cf0d15efe8e16af60b189e080
Headers show

Comments

Khem Raj - June 9, 2012, 4:43 p.m.
In some cases we need to specify linker flags and right
now we do not have a way to communicate that to cmake
based systems. cmake defines CMAKE_C_LINK_FLAGS and CMAKE_CXX_LINK_FLAGS
for these needs. This patch therefore defines two local variables
namely OECMAKE_C_LINK_FLAGS and OECMAKE_CXX_LINK_FLAGS which
can be altered by recipes to tweak linker flags

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/cmake.bbclass |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index dcd974a..eda45dd 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -23,6 +23,8 @@  OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS}"
 OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} -fpermissive"
 OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${CPPFLAGS} -DNDEBUG"
 OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${CXXFLAGS} -DNDEBUG"
+OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
+OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
 
 OECMAKE_RPATH ?= ""
 OECMAKE_PERLNATIVE_DIR ??= ""
@@ -40,6 +42,8 @@  set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
 set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
 set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "CFLAGS for release" )
 set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "CXXFLAGS for release" )
+set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
+set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
 
 # only search in the paths provided so cmake doesnt pick
 # up libraries and tools from the native build machine