diff --git a/CMakeLists.txt b/CMakeLists.txt index 2914f6ea2..41d1f7231 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename") set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules) # Contains custom functions and macros, but don't altering any options include(VCMIUtils) +vcmi_print_important_variables() # 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 @@ -90,6 +91,7 @@ if(ENABLE_GITVERSION) include(GetGitRevisionDescription) get_git_head_revision(GIT_REFSPEC GIT_SHA1) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY) + vcmi_print_git_commit_hash() else() add_definitions(-DVCMI_NO_EXTRA_VERSION) endif(ENABLE_GITVERSION) diff --git a/cmake_modules/VCMIUtils.cmake b/cmake_modules/VCMIUtils.cmake index a69bfd83d..4a7cdf1e4 100644 --- a/cmake_modules/VCMIUtils.cmake +++ b/cmake_modules/VCMIUtils.cmake @@ -63,14 +63,64 @@ endif(${CMAKE_GENERATOR} MATCHES "Xcode") # 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. -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) foreach(_variableName ${_variableNames}) message(STATUS "${_variableName}=${${_variableName}}") 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") + 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()