In CMAKE file, Platform Architecture is decided by help of below code. Irrespective of ARM boards(armv7l, armhf, etc,.), i compare only first three letters "arm". But STREQUAL compares all the characters. So is there any other CMAKE functions like strncmp() which compares only characters based on user's input or to serach "arm" in "armv7l" ?
if( ${ARCHITECTURE} STREQUAL "x86_64" )
set(arch_x86_64 ON CACHE BOOL "X86_64 Architecture")
else()
if( ${ARCHITECTURE} STREQUAL "arm")```
So is there any other CMAKE functions like strncmp() which compares only characters based on user's input or to serach "arm" in "armv7l" ?
You can extract the substring and compare:
string(SUBSTRING "${ARCHITECTURE}" 0 3 tmp)
if("${tmp}" STREQUAL "arm")
But just use a regular expression:
if("${ARCHITECTURE}" MATCHES "^arm")