summaryrefslogtreecommitdiffstats
path: root/Modules/SystemInformation.cmake
blob: fa85071067616ee3de55e337b8467cefd1000d12 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

#=============================================================================
# Copyright 2007-2010 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)

cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(DumpInformation)

# first get the standard information for th platform
include_directories("This does not exists")
get_directory_property(incl INCLUDE_DIRECTORIES)
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${DumpInformation_BINARY_DIR};${DumpInformation_SOURCE_DIR}")

configure_file("${CMAKE_ROOT}/Modules/SystemInformation.in" "${RESULT_FILE}")


file(APPEND "${RESULT_FILE}"
  "\n=================================================================\n")
file(APPEND "${RESULT_FILE}"
  "=== VARIABLES\n")
file(APPEND "${RESULT_FILE}"
  "=================================================================\n")
get_cmake_property(res VARIABLES)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "${var} \"${${var}}\"\n")
endforeach()

file(APPEND "${RESULT_FILE}"
  "\n=================================================================\n")
file(APPEND "${RESULT_FILE}"
  "=== COMMANDS\n")
file(APPEND "${RESULT_FILE}"
  "=================================================================\n")
get_cmake_property(res COMMANDS)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "${var}\n")
endforeach()

file(APPEND "${RESULT_FILE}"
  "\n=================================================================\n")
file(APPEND "${RESULT_FILE}"
  "=== MACROS\n")
file(APPEND "${RESULT_FILE}"
  "=================================================================\n")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "")
get_cmake_property(res MACROS)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "${var}\n")
endforeach()

file(APPEND "${RESULT_FILE}"
  "\n=================================================================\n")
file(APPEND "${RESULT_FILE}"
  "=== OTHER\n")
file(APPEND "${RESULT_FILE}"
  "=================================================================\n")
get_directory_property(res INCLUDE_DIRECTORIES)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "INCLUDE_DIRECTORY: ${var}\n")
endforeach()

get_directory_property(res LINK_DIRECTORIES)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "LINK_DIRECTORIES: ${var}\n")
endforeach()

get_directory_property(res INCLUDE_REGULAR_EXPRESSION)
file(APPEND "${RESULT_FILE}" "INCLUDE_REGULAR_EXPRESSION: ${res}\n")

# include other files if they are present, such as when run from within the
# binary tree
macro(DUMP_FILE THE_FILE)
  if (EXISTS "${THE_FILE}")
    file(APPEND "${RESULT_FILE}"
      "\n=================================================================\n")
    file(APPEND "${RESULT_FILE}"
      "=== ${THE_FILE}\n")
    file(APPEND "${RESULT_FILE}"
      "=================================================================\n")

    file(READ "${THE_FILE}" FILE_CONTENTS LIMIT 50000)
    file(APPEND "${RESULT_FILE}" "${FILE_CONTENTS}")
  endif ()
endmacro()

DUMP_FILE("../CMakeCache.txt")
DUMP_FILE("../CMakeFiles/CMakeOutput.log")
DUMP_FILE("../CMakeFiles/CMakeError.log")
DUMP_FILE("../CMakeFiles/CMakeSystem.cmake")

foreach (EXTRA_FILE ${EXTRA_DUMP_FILES})
  DUMP_FILE("${EXTRA_FILE}")
endforeach ()