cmake/Modules/SystemInformation.cmake

104 lines
3.6 KiB
CMake
Raw Normal View History

2009-10-04 10:30:41 +03:00
#=============================================================================
2011-01-16 11:35:12 +01:00
# Copyright 2007-2010 Kitware, Inc.
2009-10-04 10:30:41 +03:00
#
# 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.
#=============================================================================
2010-11-13 01:00:53 +02:00
# (To distribute this file outside of CMake, substitute the full
2009-10-04 10:30:41 +03:00
# License text for the above reference.)
2013-03-16 19:13:01 +02:00
cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(DumpInformation)
# first get the standard information for th platform
2013-03-16 19:13:01 +02:00
include_directories("This does not exists")
get_directory_property(incl INCLUDE_DIRECTORIES)
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${DumpInformation_BINARY_DIR};${DumpInformation_SOURCE_DIR}")
2013-03-16 19:13:01 +02:00
configure_file("${CMAKE_ROOT}/Modules/SystemInformation.in" "${RESULT_FILE}")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"\n=================================================================\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=== VARIABLES\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=================================================================\n")
2013-03-16 19:13:01 +02:00
get_cmake_property(res VARIABLES)
foreach(var ${res})
file(APPEND "${RESULT_FILE}" "${var} \"${${var}}\"\n")
endforeach()
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"\n=================================================================\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=== COMMANDS\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=================================================================\n")
2013-03-16 19:13:01 +02:00
get_cmake_property(res COMMANDS)
foreach(var ${res})
file(APPEND "${RESULT_FILE}" "${var}\n")
endforeach()
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"\n=================================================================\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=== MACROS\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=================================================================\n")
2013-03-16 19:13:01 +02:00
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/AllMacros.txt "")
get_cmake_property(res MACROS)
foreach(var ${res})
file(APPEND "${RESULT_FILE}" "${var}\n")
endforeach()
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"\n=================================================================\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=== OTHER\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=================================================================\n")
2013-03-16 19:13:01 +02:00
get_directory_property(res INCLUDE_DIRECTORIES)
foreach(var ${res})
file(APPEND "${RESULT_FILE}" "INCLUDE_DIRECTORY: ${var}\n")
endforeach()
2013-03-16 19:13:01 +02:00
get_directory_property(res LINK_DIRECTORIES)
foreach(var ${res})
file(APPEND "${RESULT_FILE}" "LINK_DIRECTORIES: ${var}\n")
endforeach()
2013-03-16 19:13:01 +02:00
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
2013-03-16 19:13:01 +02:00
macro(DUMP_FILE THE_FILE)
if (EXISTS "${THE_FILE}")
file(APPEND "${RESULT_FILE}"
"\n=================================================================\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=== ${THE_FILE}\n")
2013-03-16 19:13:01 +02:00
file(APPEND "${RESULT_FILE}"
"=================================================================\n")
2013-03-16 19:13:01 +02:00
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")
2013-03-16 19:13:01 +02:00
foreach (EXTRA_FILE ${EXTRA_DUMP_FILES})
DUMP_FILE("${EXTRA_FILE}")
2013-03-16 19:13:01 +02:00
endforeach ()