Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake -D <var>:<type>=<value>: what can <type> be?

Tags:

cmake

-D <var>:<type>=<value>: Create a cmake cache entry.

ok, but what can <type> be? I've seen BOOL, STRING, PATH, FILEPATH. What else can that type be?

like image 485
quimnuss Avatar asked Mar 21 '13 11:03

quimnuss


People also ask

How do I declare a variable in CMake?

Options and variables are defined on the CMake command line like this: $ cmake -DVARIABLE=value path/to/source You can set a variable after the initial `CMake` invocation to change its value. You can also undefine a variable: $ cmake -UVARIABLE path/to/source Variables are stored in the `CMake` cache.

What is CMake cache variable?

The CMake cache may be thought of as a configuration file. The first time CMake is run on a project, it produces a CMakeCache. txt file in the top directory of the build tree. CMake uses this file to store a set of global cache variables, whose values persist across multiple runs within a project build tree.

Can CMake set environment variables?

Every process (e.g. your bash) that creates a child process (your cmake) provides the newly process a copy of its environment. You cannot change the environment of the parent process later. But you can start a intermediate process that sets the environment variables and then starts cmake.

What are CMake options?

Provide a boolean option that the user can optionally select. If no initial <value> is provided, boolean OFF is the default value. If <variable> is already set as a normal or cache variable, then the command does nothing (see policy CMP0077 ).


1 Answers

From the CMake man page, under "Properties on Cache Entries":

TYPE   Widget type for entry in GUIs.

    Cache entry values are always strings, but CMake GUIs present widgets to help users set values.  The GUIs use this property as a hint to determine the widget type.  Valid TYPE values are:

            BOOL          = Boolean ON/OFF value.
            PATH          = Path to a directory.
            FILEPATH      = Path to a file.
            STRING        = Generic string value.
            INTERNAL      = Do not present in GUI at all.
            STATIC        = Value managed by CMake, do not change.
            UNINITIALIZED = Type not yet specified.

          Generally the TYPE of a cache entry should be set by the command which creates it (set, option, find_library, etc.).
like image 141
slugonamission Avatar answered Nov 14 '22 13:11

slugonamission