Skip to contentSkip to conversation

cmake: supply CMAKE_AR in toolchain file

PATCH In review Cody P Schafer 2 participants 3 messages Nov 12, 2014 – Dec 3, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmake: supply CMAKE_AR in toolchain file

---
 meta/classes/cmake.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/cmake.bbclass +2 -0
index 10f8f98..3549c38 100644
@@ -13,6 +13,7 @@ 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 ?= "${AR}"
 
 # Compiler flags
 OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
@@ -35,6 +36,7 @@ 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} )
+set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )
 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" )
Signature · 1 line
2.1.3
#1 lore raw
Quoted 2 lines · Cody P Schafer

+set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )

Curious - why does this line have CACHE FILEPATH "Archiver" when e.g. CMAKE_C_COMPILER doesn't? Should one or other other be fixed?

Ross

#2 lore raw

I tried the bare set(CMAKE_AR ...) first, but found it was being ignored. A bit of googling found:
http://www.cmake.org/Bug/view.php?id=13038 Which contains the solution I've used here.

Quoted 10 lines · Ross
Quoted 2 lines · Cody P Schafer

+set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )

Curious - why does this line have CACHE FILEPATH "Archiver" when e.g. CMAKE_C_COMPILER doesn't? Should one or other other be fixed?

Ross