CMake 是什么我就不用再多说什么了，相信大家都有接触才会看一篇文章。对于不太熟悉的开发人员可以把这篇文章当个查找手册。 1.CMake语法1.1 指定cmake的最小版本cmakeminimumrequired(version 版本号)例如： cm. CMAKESYSTEMNAME is by default set to the same value as the CMAKEHOSTSYSTEMNAME variable so that the build targets the host system. System Name for Cross Compiling ¶ CMAKESYSTEMNAME may be set explicitly when first configuring a new.
ARMClang cpu/arch compile and link flags must be set explicitly.
- The CMAKESYSTEMPROCESSOR is the CMake-identifier of the target architecture to build for. The CMAKESYSROOT is optional, and may be specified if a sysroot is available. The CMAKESTAGINGPREFIX is also optional. It may be used to specify a path on the host to install to.
- I believe the target processor is provided in CMAKESYSTEMPROCESSOR. The problem I am having is the docs don't tell me the values, so I can't figure out how to craft a 'not 32-bit x86' test. The problem I am having is the docs don't tell me the values, so I can't figure out how to craft a 'not 32-bit x86' test.
CMake 3.20 and lower automatically maps the
CMAKE_SYSTEM_PROCESSORvariable and an undocumented
CMAKE_SYSTEM_ARCH to compile and link optionsfor
ARMClang. For example, the
-mcpu=cortex-m33 flag is added when
cortex-m33. CMake requiresprojects to set either variable or it raises a fatal error. However, theproject may need to additionally specify CPU features using e.g.
-mcpu=cortex-m33+nodsp, conflicting with the
-mcpu=cortex-m33 addedby CMake. This results in either link errors or unusable binaries.
CMake 3.21 and above prefer instead to not add any cpu/arch compile and linkflags automatically. Instead, projects must specify them explicitly.This policy provides compatibility for projects that have not been updated.
OLD behavior of this policy requires projects that use
ARMClangto set either
CMAKE_SYSTEM_ARCHand it automatically adds a compile option
-march= anda link option
--cpu= based on those variables. The
NEW behaviordoes not add compile or link options, and projects are responsible forsetting correct options.
This policy was introduced in CMake version 3.21. CMake version 3.20.20210505-g314335awarns when the policy is not set and uses
OLD behavior. Use the
cmake_policy() command to set it to
OLD behavior of a policy is
deprecatedbydefinitionForgotten hill bundle one. and may be removed in a future version of CMake.