Skip to content

Instantly share code, notes, and snippets.

@tjyuyao
Last active May 14, 2023 15:23
Show Gist options
  • Save tjyuyao/28d13f2209cd0988bf562897e1a4eb37 to your computer and use it in GitHub Desktop.
Save tjyuyao/28d13f2209cd0988bf562897e1a4eb37 to your computer and use it in GitHub Desktop.
cmake architecture detect
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64") # for desktop
message("1")
ELSE(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") # for tx2
message("2")
ELSE()
message(FATAL_ERROR "Unknown System Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
ENDIF()
@geo-ant
Copy link

geo-ant commented Mar 28, 2023

the first ELSE should be ELSEIF, other than that this works fine!

@IGR2014
Copy link

IGR2014 commented May 14, 2023

Well, on my Windows 10 with CMake 3.26.1 ${CMAKE_SYSTEM_PROCESSOR} equals to AMD64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment