This command will set the value of a variable into the parent directory or calling function (whichever is applicable to the case at hand). If in which case the environment variable will be set.
* Variable types in CMake * In CMake there are two types of variables: normal variables and cache variables.
Now, if the parent and the child project provide the same option (for example a compiler option), the parent gets the first chance to add a user-editable option to the cache.
Normally, the child would then use the same value that the parent uses.
Normal variables are meant for the internal use of the script (just like variables in most programming languages); they are not persisted across CMake runs.
Cache variables (unless set with INTERNAL) are mostly intended for configuration settings where the first CMake run determines a suitable default value, which the user can then override, by editing the cache with tools such as ccmake or cmake-gui.
Note that custom files don't affect subdirectories in the way that .htaccess files do, so you'll need to put your custom file in any subdirectories as well.
represents paths generically with ‘/’ as the path separator and ‘.’ as the extension separator.
If ‘FOO’ is in the cache then nothing happens to either the normal variable or the cache variable.Some examples: The code ‘set(FOO “x”)’ sets the normal variable ‘FOO’.It does not touch the cache, but it will hide any existing cache value ‘FOO’.Normally projects should avoid using normal and cache variables of the same name, as this interaction can be hard to follow. One example (used by some projects): A project has a subproject in its source tree.The child project has its own CMake Lists.txt, which is included from the parent CMake using add_subdirectory().Where a device must be specified, you can do that yourself—introducing a system dependency—or allow the string object to add a default device.is INTERNAL, the cache variable is marked as internal, and will not be shown to the user in tools like cmake-gui. CACHE...) creates cache variables, but does not modify them. PATH); // Prints: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' PATH.split(path.delimiter); // Returns: ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] console.log(PATH); // Prints: ' C:\Windows\system32; C:\Windows; C:\Program Files\node\' However, it may be necessary to hard-code the value for the child project’s option while still allowing the user to edit the value used by the parent project.The parent project can achieve this simply by setting a normal variable with the same name as the option in a scope sufficient to hide the option’s cache variable from the child completely.