I came to this sentences in a CMakeLists file, I googled it but couldn't find relevant resources on the word CACHE STRING.
set(CMAKE_BUILD_TYPE Debug CACHE STRING "set build type to debug")
Run Code Online (Sandbox Code Playgroud)
What does it mean? And imho, isn't this quite obscure to use?
Read https://cmake.org/cmake/help/v3.0/command/set.html
Within CMake sets
<variable>to the value<value>.<value>is expanded before<variable>is set to it. Normally, set will set a regular CMake variable. If CACHE is present, then the<variable>is put in the cache instead, unless it is already in the cache. See section ‘Variable types in CMake’ below for details of regular and cache variables and their interactions. If CACHE is used,<type>and<docstring>are required.<type>is used by the CMake GUI to choose a widget with which the user sets a value.
STRING is the variable type; this really only affects the config tools when they display the edit widgets for a variable.
如果您想覆盖设置,通常会使用它FORCE;否则你可能不会。
不是特别难懂。
注意。aCACHE和普通变量之间的主要区别在于,它们CACHE出现在 cmake 配置工具中作为您可以设置的设置(例如 cmake-gui、ccmake)。
| 归档时间: |
|
| 查看次数: |
9071 次 |
| 最近记录: |