On Mon, 1 Apr 2019 21:18:47 +0200
Rafael Sadowski <[email protected]> wrote:

> "If the :<type> portion is given it must be one of the types specified
> by the set() command documentation for its CACHE signature."
> 
> Okay this is useless in almost all our cases because what we do is to
> modify an option()[1] and NOT a set() with a type.

option() sets a cache variable with the BOOL type.  This 3-line
CMakeLists.txt

  cmake_minimum_required(VERSION 2.6)
  project(p C)
  option(FAST "Be fast" OFF)

creates an entry in CMakeCache.txt

  //Be fast
  FAST:BOOL=OFF

If I use cmake -DFAST=ON, it creates an entry

  //Be fast
  FAST:BOOL=ON

Older versions of CMake needed a type like -DFAST:BOOL=ON, but newer
versions don't need a type in -D.

All CMake variables are strings.  The strings can be true or false by
the rules that you quoted.  Unless I forgot something, the cache type
like BOOL is only for editing the cache with an interactive tool like
ccmake(1).  The tool might want to use a checkbox or a file dialog
with different types of cache variables.

-- 
George Koehler <[email protected]>

Reply via email to