Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v2] cmake.bbclass: allow searching host paths for non-target builds
@ 2013-07-17  6:26 Jonathan Liu
  2013-07-17  7:46 ` Stefan Herbrechtsmeier
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Liu @ 2013-07-17  6:26 UTC (permalink / raw)
  To: openembedded-core

This allows /usr/bin/{ld,ar,objcopy,objdump,ranlib,strip} to be found
and the CMAKE_{LINKER,AR,OBJCOPY,OBJDUMP,RANLIB,STRIP} cmake variables
to be properly set for native cmake recipes.

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 meta/classes/cmake.bbclass | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 310242e..2040147 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -46,12 +46,7 @@ set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "CXXFLA
 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
 set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST} ${STAGING_DIR_NATIVE} ${CROSS_DIR} ${OECMAKE_PERLNATIVE_DIR} ${OECMAKE_EXTRA_ROOT_PATH} ${EXTERNAL_TOOLCHAIN})
-set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
 
 # Use qt.conf settings
 set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )
@@ -69,6 +64,16 @@ set( CMAKE_LIBRARY_PATH ${libdir} ${base_libdir})
 EOF
 }
 
+cmake_do_generate_toolchain_file_append_class-target() {
+	cat >> ${WORKDIR}/toolchain.cmake <<EOF
+# only search in the paths provided so cmake doesnt pick
+# up libraries and tools from the native build machine
+set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
+set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
+set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
+EOF
+}
+
 addtask generate_toolchain_file after do_patch before do_configure
 
 cmake_do_configure() {
-- 
1.8.3.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] cmake.bbclass: allow searching host paths for non-target builds
  2013-07-17  6:26 [PATCH v2] cmake.bbclass: allow searching host paths for non-target builds Jonathan Liu
@ 2013-07-17  7:46 ` Stefan Herbrechtsmeier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Herbrechtsmeier @ 2013-07-17  7:46 UTC (permalink / raw)
  To: Jonathan Liu; +Cc: openembedded-core

Am 17.07.2013 08:26, schrieb Jonathan Liu:
> This allows /usr/bin/{ld,ar,objcopy,objdump,ranlib,strip} to be found
> and the CMAKE_{LINKER,AR,OBJCOPY,OBJDUMP,RANLIB,STRIP} cmake variables
> to be properly set for native cmake recipes.
>
> Signed-off-by: Jonathan Liu <net147@gmail.com>
> ---
>   meta/classes/cmake.bbclass | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index 310242e..2040147 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -46,12 +46,7 @@ set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "CXXFLA
>   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
>   set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_HOST} ${STAGING_DIR_NATIVE} ${CROSS_DIR} ${OECMAKE_PERLNATIVE_DIR} ${OECMAKE_EXTRA_ROOT_PATH} ${EXTERNAL_TOOLCHAIN})
> -set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
> -set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
> -set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
This changes the whole find behaviour and allows cmake to find *all* 
software from the native build machine.  You should add 
NO_CMAKE_FIND_ROOT_PATH to the find_xxx calls or you could manual set 
the variables and bypass the find calls.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-17  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-17  6:26 [PATCH v2] cmake.bbclass: allow searching host paths for non-target builds Jonathan Liu
2013-07-17  7:46 ` Stefan Herbrechtsmeier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox