andry81/tacklelib

View on GitHub
_config/cmake/config.system.vars.in

Summary

Maintainability
Test Coverage
#%% version: 1

# CAUTION:
#  This configuration file is designed to be portable between 3 interpreters: cmake, unix shell scripts, windows (cmd.exe) batch scripts,
#  so it is made up to be simple as possible but not simplier as to support a single value or a values list
#  together with an escape sequence, where the character `\` is not an escape sequence character.
#  Use `$/<char>` to escape a `<char>` character which is a part of a configuration file format:
#  `"` -> `$/"` or `(` -> `$/(` or `$/` -> `$/$/`
#  Use `$/{` as a start sequence for a variable's value substitution: `$/{<variable>}`, where `<variable>`
#  is already parsed variable from configuration file WITHOUT condition(s) or `:` characters. Otherwise a not yet parsed variable or
#  invalid one will be replaced by the `*:$/{<variable>}` sequence to fail the most usage cases in a file path,
#  where `*:` - is not valid character sequence in a windows path (`:` character additionally can block a relative path *after* the variable)
#  and `/` is a character to block a file or directory creation with such a name on a Linux system (but not a block for `mkdir -p`!).
#  In all other cases the `$/` sequence prints as is in all contexts: in a cmake script, in a unix shell script and in a
#  windows batch script.

# CAUTION:
#  DO NOT USE `@` character pairs unescaped as a plain value as long as it is used as a placehoder in a replacement of `@<variable>@` sequence,
#  where the `<variable>` is a cmake variable. For that case do replace all `@` characters by this escape sequence: `$/@`.
#  It will avoid the substitution in case of an accidental match.

# NOTE:
#  In a unix shell script a variable name with `:` character is not permitted, so variables with not allowed characters
#  won't be visible in a windows batch script too.

# FORMAT:
#   [<attributes>] <variable>[:[<os_name>][:[<compiler_name>][:[<config_name>][:[<arch_name>]]]]][=<value>]
#   [<attributes>] <variable>[:[<os_name>][:[<compiler_name>][:[<config_name>][:[<arch_name>]]]]][=(<value0> [<value1> [... <valueN>]])]
#
# <attributes>:           Variable space separated attributes:
#                           global | top | local | bool | path | exist | canonical | optional |
#                           uncache | cache_only | cache | env_only | env | force_cache | force | override |
#                           unset | (un)hide | package | final
# <variable>:             Variable name corresponding to the regex: [_a-zA-Z][_a-zA-Z0-9]*
# <os_name>:              OS variant name: WIN | UNIX | ...
# <compiler_name>:        Compiler variant name with version support: <compiler_token_name>[.<compiler_version>]
#   <compiler_token_name>: MSVC | GCC | CLANG | ...
#   <compiler_version>:   <major_version>[*+] | <major_version>.<minor_version>[*+]
#     <major_version>:    an integral value corresponding to the regex: [0-9]*
#     <minor_version>:    an integral value corresponding to the regex: [0-9]*
# <config_name>:          Configuration name: RELEASE | DEBUG | RELWITHDEBINFO | MINSIZEREL | ...
# <arch_name>:            Architecture variant name: X86 | X64 | ...
#
# <value>:                Value with escaping and substitution support: `$/<escape_char>`, `$/{<variable>}`
#

# PREDEFINED BUILTIN VARIABLES ACCESIBLE FROM THIS FILE:
#
# CMAKE_CURRENT_LOAD_VARS_FILE_INDEX:           Index in a file paths list from which this file have has an ordered load.
# CMAKE_CURRENT_LOAD_VARS_FILE_DIR:             Directory path from which this file being loaded from.
# CMAKE_CURRENT_PACKAGE_NEST_LVL:               Current package nest level.
# CMAKE_CURRENT_PACKAGE_NEST_LVL_PREFIX:        Current package nest level prefix string like `00` if level is `0`, or `01` if level is `1` and so on.
# CMAKE_CURRENT_PACKAGE_NAME:                   Current package name this file being loaded from.
# CMAKE_CURRENT_PACKAGE_SOURCE_DIR:             Current package source directory this file being loaded from.
# CMAKE_TOP_PACKAGE_NAME:                       Top package name.
# CMAKE_TOP_PACKAGE_SOURCE_DIR:                 Top package source directory.
#

# CAUTION:
#   This file can be loaded not from the cmake loader which means that the
#   `<compiler_name>`, `<config_name>` and `<arch_name>` filter value is not known yet.
#   So you must not use them here but use them instead in the user environment file!
#

## required program variables and paths
#final path exist WINDIR:WIN="C:\Windows"
#final path exist CMAKE_COMMAND_DIR:WIN="C:\Program Files\CMake\bin"
#final path exist MSYS_ROOT:WIN="c:/msys32/20190524/usr"
#final path exist MSYS_BIN_DIR:WIN="$/{MSYS_ROOT}/bin"
#final path exist canonical CMAKE_MAKE_PROGRAM:WIN="$/{MSYS_BIN_DIR}/make.exe"
#final path exist canonical CC=$/{MSYS_BIN_DIR}/gcc.exe
#final path exist canonical CXX=$/{MSYS_BIN_DIR}/g++.exe
#final package force CMAKE_CXX_FLAGS=-I$/{MSYS_ROOT}/include
#
## WORKAROUND: For MinGW make to work correctly with the `sh.exe`, must NOT be in your path.
#final path exist PATH:WIN=("$/{WINDIR}\system32" "$/{WINDIR}" "$/{WINDIR}\System32\Wbem" "$/{WINDIR}\System32\WindowsPowerShell\v1.0\" "$/{CMAKE_COMMAND_DIR}" "$/{MSYS_BIN_DIR}")

# to enable Mingw GCC compiler
#MINGW:WIN=ON

# always required system variables <<
top CMAKE_GENERATOR:WIN="Visual Studio 15 2017"
#top CMAKE_GENERATOR:WIN="MinGW Makefiles"
#top CMAKE_GENERATOR:WIN="MSYS Makefiles"

top CMAKE_GENERATOR:UNIX="Unix Makefiles"

top CMAKE_OUTPUT_ROOT="$/{CMAKE_TOP_PACKAGE_SOURCE_DIR}/_out/cmake"
final package CMAKE_OUTPUT_GENERATOR_DIR="$/{CMAKE_OUTPUT_ROOT}/$/{CMAKE_GENERATOR}"
final package CMAKE_OUTPUT_DIR="$/{CMAKE_OUTPUT_GENERATOR_DIR}/$/{CMAKE_CURRENT_PACKAGE_NEST_LVL_PREFIX}--$/{CMAKE_CURRENT_PACKAGE_NAME}"
final package CMAKE_BUILD_ROOT="$/{CMAKE_OUTPUT_DIR}/build"
final package CMAKE_BIN_ROOT="$/{CMAKE_OUTPUT_DIR}/bin"
final package CMAKE_LIB_ROOT="$/{CMAKE_OUTPUT_DIR}/lib"
final package CMAKE_INSTALL_ROOT="$/{CMAKE_OUTPUT_DIR}/install"   # cmake creates the build type subdirectory on itself
final package CMAKE_PACK_ROOT="$/{CMAKE_OUTPUT_DIR}/pack"

top force CMAKE_INSTALL_PREFIX="$/{CMAKE_INSTALL_ROOT}" # with force to bypass ODR violation
top CPACK_OUTPUT_FILE_PREFIX="$/{CMAKE_PACK_ROOT}"

final package PROJECT_NAME=tacklelib
final package PROJECT_ROOT="$/{CMAKE_CURRENT_PACKAGE_SOURCE_DIR}" # current project root
top PROJECT_TOP_ROOT="$/{CMAKE_TOP_PACKAGE_SOURCE_DIR}"           # top parent project root in context of parent build

# CAUTION: SHOULD NOT BE TOP LEVEL, because each project might have has it's own 3dparty search paths
final package _3DPARTY_GLOBAL_ROOTS_LIST=("$/{CMAKE_CURRENT_LOAD_VARS_FILE_DIR}")

# NOTE: Must be without `.in` suffix.
final package _3DPARTY_GLOBAL_ROOTS_FILE_LIST=("config.3dparty.vars")

top CMAKE_CONFIG_TYPES=(Release Debug RelWithDebInfo MinSizeRel)  # list variable
top CMAKE_CONFIG_ABBR_TYPES=(r d rd rm)
# >> always required system variables