query
On this page

cmakeOptionType

lib.strings.cmakeOptionType

Docs pulled from | This Revision | 14 minutes ago


Create a "-D<feature>:<type>=<value>" string that can be passed to typical CMake invocations.

Inputs

feature
The feature to be set
type
The type of the feature to be set, as described in https://cmake.org/cmake/help/latest/command/set.html the possible values (case insensitive) are: BOOL FILEPATH PATH STRING INTERNAL
value
The desired value

Type

cmakeOptionType :: string -> string -> string -> string

Examples

lib.strings.cmakeOptionType usage example

cmakeOptionType "string" "ENGINE" "sdl2"
=> "-DENGINE:STRING=sdl2"

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

cmakeOptionType = let
    types = [ "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL" ];
  in type: feature: value:
    assert (elem (toUpper type) types);
    assert (isString feature);
    assert (isString value);
    "-D${feature}:${toUpper type}=${value}";