[Cmake] CMake SET + CMakeCache.txt

Brad King brad.king at kitware.com
Fri Apr 4 10:56:13 EST 2003


> I have the line:
>
> # Compiler flags
> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
>
> at the end of my CMakeLists.txt  file.
>
> I was expecting, after running cmake, that when I looked in
> CMakeCache.txt that the line
>
> //Flags used by the compiler during all build types.
> CMAKE_CXX_FLAGS:STRING=
>
> would actually have "-Wno-deprecated"   on it.  But it doesn't.

The SET command sets cmake variables.  The cache entries are used to
INITIALIZE the variables.  A SET command with the CACHE option is used to
INITIALIZE a cache entry that doesn't exist.  Once a value is set in the
cache, it can be changed only by the user from the GUI.

> Can someone explain to me this mechanism please ?  I have looked in the
> FAQ and documentation but can't find anything relevant.
> ------------------------------------------------------------------------
> A second thing.  The documentation for the SET function does not inform
> you what the possible types for argument "TYPE" are.  It says you can
> use INTERNAL but there is no other advice. Since SET is a rather
> important command, it would be helpful to describe its arguments more
> carefully.

The types are used by the GUI to choose a widget with which the user sets
a value.  The possible types are:

  FILEPATH = File chooser dialog.
  PATH     = Directory chooser dialog.
  STRING   = Arbitrary string.
  BOOL     = Boolean ON/OFF value.
  INTERNAL = No GUI entry (used for persistent variables).

This will be added to the documentation in the next version of cmake.

-Brad




More information about the CMake mailing list