summaryrefslogtreecommitdiff
path: root/Modules/SystemInformation.cmake
blob: 97f385612c3b71aec7eca906af72c39b3a35d9b3 (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
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.


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

# first get the standard information for the platform
include_directories("This does not exist")
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/CMakeSystem.cmake")

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