CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM Without cross compiling the variables for the host system and the target system are identical. In most cases you will want to testfor the target system, then the same way as without cross compiling use the CMAKE_SYSTEM_xxx variables,this will wo...
message(STATUS "The CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P}.") message(STATUS "The CMAKE_HOST_WIN32 is ${CMAKE_HOST_WIN32}.") message(STATUS "The CMAKE_HOST_UNIX is ${CMAKE_HOST_UNIX}.") message(STATUS "The CMAKE_HOST_SYSTEM_PROCESSOR is ${CMAKE_HOST_SYSTEM_PROCESSOR...
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i386") message(STATUS "i386 architecture detected") elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686") message(STATUS "i686 architecture detected") elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64") message(STATUS "x86_64 architecture detected") else()...
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_SYSROOT /path/to/rootfs) set(CMAKE_STAGING_PREFIX /path/to/stage) set(tools /path/to/arm-gcc) set(CMAKE_C_COMPILER ${tools}/bin/XXX-gcc) set(CMAKE_CXX_COMPILER ${tools}/bin/XXX-g++) ...
PROCESSOR_SERIAL_NUMBER:处理器序列号。 PROCESSOR_NAME:可读的处理器全称。 OS_NAME:操作系统名称,也就是uname -s的输出,三大操作系统对应的名称是Linux、Windows和Darwin(masOS),也可以通过CMAKE_HOST_SYSTEM_NAME变量获取。 OS_RELEASE:操作系统子类型,例如Windows Professional。
CMAKE_SYSTEM_PROCESSOR target 的处理器架构 CMAKE_SYSTEM_NAME: 即你目标机target所在的操作系统名称,比如ARM或者Linux你就需要写"Linux",如果Windows平台你就写"Windows",如果你的嵌入式平台没有相关OS你即需要写成"Generic",只有当CMAKE_SYSTEM_NAME这个变量被设置了,CMake才认为此时正在交叉编译,它会额外设置一...
CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_IGNORE_PATH CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_INCLUDE_CURRENT_DIR CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE CMAKE_INCLUDE_DIRECTORIES_BEFORE ...
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i386") message(STATUS "i386 architecture detected") elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686") message(STATUS "i686 architecture detected") elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64") ...
if(CMAKE_HOST_WIN32)set(WINDOWS1)elseif(CMAKE_HOST_APPLE)set(MACOS1)elseif(CMAKE_HOST_UNIX)set(LINUX1)endif() 然后用CMAKE_SYSTEM_PROCESSOR来区分处理器: if(WINDOWS)MESSAGE(STATUS"Link directory: ${PROJECT_SOURCE_DIR}/platforms/win/lib/")link_directories("${PROJECT_SOURCE_DIR}/platforms/...
message(STATUS "CMAKE_SYSTEM_PROCESSOR=<${CMAKE_SYSTEM_PROCESSOR}>") ...further logic to switch on this... it prints outarmv8as the CMAKE_SYSTEM_PROCESSOR but this variable should follow uname naming (perhttps://cmake.org/cmake/help/latest/variable/CMAKE_HOST_SYSTEM_PROCESSOR.html#variab...