SystemInformation.cmake 3.57 KB
Newer Older
1 2

#=============================================================================
3
# Copyright 2007-2010 Kitware, Inc.
4 5 6 7 8 9 10 11
#
# 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.
#=============================================================================
12
# (To distribute this file outside of CMake, substitute the full
13 14
#  License text for the above reference.)

15 16
cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(DumpInformation)
17 18

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

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


26
file(APPEND "${RESULT_FILE}"
27
  "\n=================================================================\n")
28
file(APPEND "${RESULT_FILE}"
29
  "=== VARIABLES\n")
30
file(APPEND "${RESULT_FILE}"
31
  "=================================================================\n")
32 33 34
get_cmake_property(res VARIABLES)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "${var} \"${${var}}\"\n")
35
endforeach()
36

37
file(APPEND "${RESULT_FILE}"
38
  "\n=================================================================\n")
39
file(APPEND "${RESULT_FILE}"
40
  "=== COMMANDS\n")
41
file(APPEND "${RESULT_FILE}"
42
  "=================================================================\n")
43 44 45
get_cmake_property(res COMMANDS)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "${var}\n")
46
endforeach()
47

48
file(APPEND "${RESULT_FILE}"
49
  "\n=================================================================\n")
50
file(APPEND "${RESULT_FILE}"
51
  "=== MACROS\n")
52
file(APPEND "${RESULT_FILE}"
53
  "=================================================================\n")
54 55 56 57
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "")
get_cmake_property(res MACROS)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "${var}\n")
58
endforeach()
59

60
file(APPEND "${RESULT_FILE}"
61
  "\n=================================================================\n")
62
file(APPEND "${RESULT_FILE}"
63
  "=== OTHER\n")
64
file(APPEND "${RESULT_FILE}"
65
  "=================================================================\n")
66 67 68
get_directory_property(res INCLUDE_DIRECTORIES)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "INCLUDE_DIRECTORY: ${var}\n")
69
endforeach()
70

71 72 73
get_directory_property(res LINK_DIRECTORIES)
foreach(var ${res})
  file(APPEND "${RESULT_FILE}" "LINK_DIRECTORIES: ${var}\n")
74
endforeach()
75

76 77
get_directory_property(res INCLUDE_REGULAR_EXPRESSION)
file(APPEND "${RESULT_FILE}" "INCLUDE_REGULAR_EXPRESSION: ${res}\n")
78 79 80

# include other files if they are present, such as when run from within the
# binary tree
81 82 83
macro(DUMP_FILE THE_FILE)
  if (EXISTS "${THE_FILE}")
    file(APPEND "${RESULT_FILE}"
84
      "\n=================================================================\n")
85
    file(APPEND "${RESULT_FILE}"
86
      "=== ${THE_FILE}\n")
87
    file(APPEND "${RESULT_FILE}"
88
      "=================================================================\n")
89

90 91
    file(READ "${THE_FILE}" FILE_CONTENTS LIMIT 50000)
    file(APPEND "${RESULT_FILE}" "${FILE_CONTENTS}")
92 93
  endif ()
endmacro()
94 95 96 97 98

DUMP_FILE("../CMakeCache.txt")
DUMP_FILE("../CMakeFiles/CMakeOutput.log")
DUMP_FILE("../CMakeFiles/CMakeError.log")
DUMP_FILE("../CMakeFiles/CMakeSystem.cmake")
Ken Martin's avatar
Ken Martin committed
99

100
foreach (EXTRA_FILE ${EXTRA_DUMP_FILES})
Ken Martin's avatar
Ken Martin committed
101
  DUMP_FILE("${EXTRA_FILE}")
102
endforeach ()
Ken Martin's avatar
Ken Martin committed
103