1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

CMake: print useful debug information on every build

That way we don't need to ask more questions regarding system where build failed.
This commit is contained in:
Arseniy Shestakov 2017-09-06 12:24:39 +03:00
parent ce4b206472
commit 610740011c
2 changed files with 55 additions and 3 deletions

View File

@ -68,6 +68,7 @@ set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules) set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
# Contains custom functions and macros, but don't altering any options # Contains custom functions and macros, but don't altering any options
include(VCMIUtils) include(VCMIUtils)
vcmi_print_important_variables()
# Options to enable folders in CMake generated projects for Visual Studio, Xcode, etc # Options to enable folders in CMake generated projects for Visual Studio, Xcode, etc
# Very useful to put 3rd-party libraries such as Minizip, GoogleTest and FuzzyLite in their own folders # Very useful to put 3rd-party libraries such as Minizip, GoogleTest and FuzzyLite in their own folders
@ -90,6 +91,7 @@ if(ENABLE_GITVERSION)
include(GetGitRevisionDescription) include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1) get_git_head_revision(GIT_REFSPEC GIT_SHA1)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY)
vcmi_print_git_commit_hash()
else() else()
add_definitions(-DVCMI_NO_EXTRA_VERSION) add_definitions(-DVCMI_NO_EXTRA_VERSION)
endif(ENABLE_GITVERSION) endif(ENABLE_GITVERSION)

View File

@ -63,14 +63,64 @@ endif(${CMAKE_GENERATOR} MATCHES "Xcode")
# Can be called to see check cmake variables and environment variables # Can be called to see check cmake variables and environment variables
# For "install" debugging just copy it here. There no easy way to include modules from source. # For "install" debugging just copy it here. There no easy way to include modules from source.
function(vcmi_get_cmake_debug_info) function(vcmi_print_all_variables)
message(STATUS "Debug - Internal variables:") message(STATUS "-- -- Start of all internal variables")
get_cmake_property(_variableNames VARIABLES) get_cmake_property(_variableNames VARIABLES)
foreach(_variableName ${_variableNames}) foreach(_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}") message(STATUS "${_variableName}=${${_variableName}}")
endforeach() endforeach()
message(STATUS "Debug - Environment variables:") message(STATUS "-- -- End of all internal variables")
message(STATUS "--")
message(STATUS "-- -- Start of all environment variables")
execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "environment") execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "environment")
message(STATUS "-- -- End of all environment variables")
endfunction()
# Print CMake variables most important for debugging
function(vcmi_print_important_variables)
message(STATUS "-- -- Start of VCMI build debug information")
message(STATUS "CMAKE_VERSION: " ${CMAKE_VERSION})
message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
message(STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR})
message(STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR})
# message(STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR})
# message(STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR})
message(STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH})
message(STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND})
message(STATUS "CMAKE_ROOT: " ${CMAKE_ROOT})
# message(STATUS "CMAKE_CURRENT_LIST_FILE and LINE: ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
# message(STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH})
# message(STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH})
message(STATUS "UNIX: ${UNIX} - WIN32: ${WIN32} - APPLE: ${APPLE}")
message(STATUS "MINGW: ${MINGW} - CYGWIN: ${CYGWIN} - MSVC: ${MSVC}")
message(STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID})
message(STATUS "CMAKE_CXX_COMPILER_VERSION: " ${CMAKE_CXX_COMPILER_VERSION})
message(STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER})
message(STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER})
# message(STATUS "CMAKE_COMPILER_IS_GNUCC: " ${CMAKE_COMPILER_IS_GNUCC})
# message(STATUS "CMAKE_COMPILER_IS_GNUCXX: " ${CMAKE_COMPILER_IS_GNUCXX})
# message(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
# message(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
message(STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM})
message(STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
message(STATUS "CMAKE_SYSTEM_VERSION: " ${CMAKE_SYSTEM_VERSION})
message(STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR})
message(STATUS "-- -- End of VCMI build debug information")
endfunction()
# Print Git commit hash
function(vcmi_print_git_commit_hash)
message(STATUS "-- -- Start of Git information")
message(STATUS "GIT_SHA1: " ${GIT_SHA1})
message(STATUS "-- -- End of Git information")
endfunction() endfunction()