All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmake.bbclass: Do not use bitbake variable syntax for shell variables
@ 2017-04-19 16:57 Peter Kjellerstedt
  0 siblings, 0 replies; only message in thread
From: Peter Kjellerstedt @ 2017-04-19 16:57 UTC (permalink / raw)
  To: openembedded-core

Using bitbake variable syntax (i.e., ${FOO}) for shell variables is
bad practice. First of all it is confusing, but more importantly it
can lead to weird problems if someone actually defines a bitbake
variable with the same name as the shell variable.

Also use lower case for local shell variables.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/classes/cmake.bbclass | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 3f670919a8..20d8a61069 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -43,12 +43,12 @@ def map_target_arch_to_uname_arch(target_arch):
 
 cmake_do_generate_toolchain_file() {
 	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
-	    CMAKE_CROSSCOMPILING="set( CMAKE_CROSSCOMPILING FALSE )"
+		cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )"
 	fi
 	cat > ${WORKDIR}/toolchain.cmake <<EOF
 # CMake system name must be something like "Linux".
 # This is important for cross-compiling.
-${CMAKE_CROSSCOMPILING}
+$cmake_crosscompiling
 set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` )
 set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
 set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
@@ -107,13 +107,13 @@ cmake_do_configure() {
 
 	# Just like autotools cmake can use a site file to cache result that need generated binaries to run
 	if [ -e ${WORKDIR}/site-file.cmake ] ; then
-		OECMAKE_SITEFILE=" -C ${WORKDIR}/site-file.cmake"
+		oecmake_sitefile="-C ${WORKDIR}/site-file.cmake"
 	else
-		OECMAKE_SITEFILE=""
+		oecmake_sitefile=
 	fi
 
 	cmake \
-	  ${OECMAKE_SITEFILE} \
+	  $oecmake_sitefile \
 	  ${OECMAKE_SOURCEPATH} \
 	  -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
 	  -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix'))} \
-- 
2.12.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-19 21:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 16:57 [PATCH] cmake.bbclass: Do not use bitbake variable syntax for shell variables Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.