[OE-core] [PATCH] cmake.bbclass: set ar/ld/nm/objcopy/objdump/ranlib/strip native paths

Jonathan Liu net147 at gmail.com
Wed Jul 17 08:40:22 UTC 2013


The CMAKE_{AR,LINKER,NM,OBJCOPY,OBJDUMP,RANLIB,STRIP} cmake variables
are currently set to values like CMAKE_LINKER-NOTFOUND for native
recipes because the host paths are not searched. This is because the
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM cmake variable is set to ONLY.

To resolve this, explicitly set the variables using FIND_PROGRAM and
pass the CMAKE_FIND_ROOT_PATH_BOTH option so the host paths are also
searched.

Signed-off-by: Jonathan Liu <net147 at gmail.com>
---
 meta/classes/cmake.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 310242e..31166e0 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -69,6 +69,18 @@ set( CMAKE_LIBRARY_PATH ${libdir} ${base_libdir})
 EOF
 }
 
+cmake_do_generate_toolchain_file_append_class-native() {
+	cat >> ${WORKDIR}/toolchain.cmake <<EOF
+FIND_PROGRAM(CMAKE_AR ${AR} CMAKE_FIND_ROOT_PATH_BOTH)
+FIND_PROGRAM(CMAKE_LINKER ${LD} CMAKE_FIND_ROOT_PATH_BOTH)
+FIND_PROGRAM(CMAKE_NM ${NM} CMAKE_FIND_ROOT_PATH_BOTH)
+FIND_PROGRAM(CMAKE_OBJCOPY ${OBJCOPY} CMAKE_FIND_ROOT_PATH_BOTH)
+FIND_PROGRAM(CMAKE_OBJDUMP ${OBJDUMP} CMAKE_FIND_ROOT_PATH_BOTH)
+FIND_PROGRAM(CMAKE_RANLIB ${RANLIB} CMAKE_FIND_ROOT_PATH_BOTH)
+FIND_PROGRAM(CMAKE_STRIP ${STRIP} CMAKE_FIND_ROOT_PATH_BOTH)
+EOF
+}
+
 addtask generate_toolchain_file after do_patch before do_configure
 
 cmake_do_configure() {
-- 
1.8.3.2




More information about the Openembedded-core mailing list