aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/cmake/BuildVersion.cmake
blob: f86e9e53e2d83bd34bf00c10b51a7938746b4697 (plain)
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
# -*- cmake -*-

include(Python)

if (NOT SCRIPTS_DIR)
  set( SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/../scripts" )
endif (NOT SCRIPTS_DIR)

macro (build_version _target)
  execute_process(
      COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/viewer_info.py --version
      OUTPUT_VARIABLE ${_target}_VERSION
      OUTPUT_STRIP_TRAILING_WHITESPACE
      )

  execute_process(
      COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/viewer_info.py --name
      OUTPUT_VARIABLE ${_target}_NAME
      OUTPUT_STRIP_TRAILING_WHITESPACE
      )

  execute_process(
      COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/viewer_info.py --bundle-id
      OUTPUT_VARIABLE ${_target}_BUNDLE_ID
      OUTPUT_STRIP_TRAILING_WHITESPACE
      )

  if ("${_target}_VERSION" AND "${_target}_NAME")
    message(STATUS "Version of ${_target} is ${${_target}_NAME} ${${_target}_VERSION}")
  else (${_target}_VERSION)
    message(SEND_ERROR "Could not determine ${_target} version")
  endif ("${_target}_VERSION" AND "${_target}_NAME")
endmacro (build_version)