Cached variables in CMake have one of several types:
| Type identifier | Description |
|---|---|
BOOL |
Boolean ON/OFF value. |
FILEPATH |
Path to a file on disk. |
PATH |
Path to a directory on disk. |
STRING |
A line of text. |
INTERNAL |
A line of text. cmake-gui does not show internal entries. They may be used to store variables persistently across runs. |
If I want to store a CMake-style* list of file paths or directory paths, should I define it as FILEPATH or PATH, respectively? As a STRING?
* - i.e. represented in a semicolon-separated string.
FILEPATHandPATHare suitable only for a single path. E.g. when a user fills parameters of one of these types, CMake GUI provides a path-selection dialog.For the list of paths use
STRINGparameter.In case you will use non-semicolon separator between paths, you will need to convert that separator to semicolon before use that list in
CMakeLists.txt. E.g. you could choose a colon (:) to be used a separator, like for the PATH variable on Linux.