Skip to contentSkip to conversation

cmake: improve CMAKE_SYSTEM_PROCESSOR assignment in nativesdk

PATCH In review Ross Burton 2 participants 2 messages Oct 11, 2016 – Oct 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmake: improve CMAKE_SYSTEM_PROCESSOR assignment in nativesdk

The previous string manipulations would result in the wrong string being used for machines such as intel-corei7-64 as the sysroot was split at the first hyphen (so would result in corei7 instead of corei7-64).

Change the logic so that it looks for processor-distro-os and uses the whole of the processor field.

---
 meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake +4 -2
index 0ce6573..6518408 100644
@@ -10,8 +10,10 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
 
-string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT})
-string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
+# Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os).
+if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+")
+  set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1})
+endif()
 
 # Include the toolchain configuration subscripts
 file( GLOB toolchain_config_files "${CMAKE_TOOLCHAIN_FILE}.d/*.cmake" )
Signature · 1 line
2.8.1
Acked-by Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Ross Burton

The previous string manipulations would result in the wrong string being used for machines such as intel-corei7-64 as the sysroot was split at the first hyphen (so would result in corei7 instead of corei7-64).

Change the logic so that it looks for processor-distro-os and uses the whole of the processor field.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750