aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/Modules/cmake_variables_helper.cmake
blob: 832dd4cc818991e1d375df166380e4c550844271 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This file contains helper macro to print env variables as status messages

# print_variable
#
# Prints a status message with the value of the variable
#
# Parameters:
#  variableName - A string containing the name of the variable to be printed
#
# Usage:
#  print_variable(CMAKE_CURRENT_BINARY_DIR)
#
# Output:
#  -- CMAKE_CURRENT_BINARY_DIR=/home/xxx/xxx
#
macro(print_variable _variableName)
  message(STATUS "${_variableName}=${${_variableName}}")
endmacro()

# print_all_variables
#
# Prints a status message for all currently defined variables.
#
# Parameters:
#  none
#
# Usage:
#  print_all_variable()
#
# Output:
#  -- ------------------------------ print variables ------------------------------
#  -- CMAKE_CURRENT_BINARY_DIR=/home/xxx/xxx
#  -- ....
#  -- -----------------------------------------------------------------------------
#
macro(print_all_variables)
  message(STATUS "------------------------------ print variables ------------------------------")
  get_cmake_property(_variableNames VARIABLES)

  foreach(_variableName ${_variableNames})
    print_variable(${_variableName})
  endforeach()
  message(STATUS "-----------------------------------------------------------------------------")
endmacro()