function(XmakePrintInfoCmake)
    message(STATUS "==========================================================")
    message(STATUS "Cmake Version = ${CMAKE_VERSION}")
    message(STATUS "CMAKE_GENERATOR = ${CMAKE_GENERATOR}")
    message(STATUS "CMAKE_MAKE_PROGRAM = ${CMAKE_MAKE_PROGRAM}")
    message(STATUS "CMAKE_AR = ${CMAKE_AR}")
    message(STATUS "CMAKE_COMMAND = ${CMAKE_COMMAND}")
    message(STATUS "CMAKE_CTEST_COMMAND = ${CMAKE_CTEST_COMMAND}")
endfunction()

function(XmakePrintInfoHost)
    message(STATUS "==========================================================")
    message(STATUS "APPLE = ${APPLE}")
    message(STATUS "CMAKE_HOST_APPLE = ${CMAKE_HOST_APPLE}")
    message(STATUS "CMAKE_HOST_SYSTEM_NAME = ${CMAKE_HOST_SYSTEM_NAME}")
    message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR = ${CMAKE_HOST_SYSTEM_PROCESSOR}")
    message(STATUS "CMAKE_HOST_SYSTEM = ${CMAKE_HOST_SYSTEM}")
    message(STATUS "CMAKE_HOST_SYSTEM_VERSION = ${CMAKE_HOST_SYSTEM_VERSION}")
    message(STATUS "CMAKE_HOST_UNIX = ${CMAKE_HOST_UNIX}")
    message(STATUS "CMAKE_HOST_WIN32 = ${CMAKE_HOST_WIN32}")
    message(STATUS "CMAKE_LIBRARY_ARCHITECTURE = ${CMAKE_LIBRARY_ARCHITECTURE}")
    message(STATUS "CMAKE_OBJECT_PATH_MAX = ${CMAKE_OBJECT_PATH_MAX}")
    message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
    message(STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
    message(STATUS "CMAKE_SYSTEM = ${CMAKE_SYSTEM}")
    message(STATUS "CMAKE_SYSTEM_VERSION = ${CMAKE_SYSTEM_VERSION}")
    message(STATUS "CYGWIN = ${CYGWIN}")
    message(STATUS "MINGW = ${MINGW}")
    message(STATUS "MSVC10 = ${MSVC10}")
    message(STATUS "MSVC11 = ${MSVC11}")
    message(STATUS "MSVC12 = ${MSVC12}")
    message(STATUS "MSVC14 = ${MSVC14}")
    message(STATUS "MSVC60 = ${MSVC60}")
    message(STATUS "MSVC70 = ${MSVC70}")
    message(STATUS "MSVC71 = ${MSVC71}")
    message(STATUS "MSVC80 = ${MSVC80}")
    message(STATUS "MSVC90 = ${MSVC90}")
    message(STATUS "MSVC_IDE = ${MSVC_IDE}")
    message(STATUS "MSVC = ${MSVC}")
    message(STATUS "MSVC_VERSION = ${MSVC_VERSION}")
    message(STATUS "UNIX = ${UNIX}")
    message(STATUS "WIN32 = ${WIN32}")
    message(STATUS "WINCE = ${WINCE}")
    message(STATUS "XCODE = ${XCODE}")
    message(STATUS "XCODE_VERSION = ${XCODE_VERSION}")
endfunction()

function(XmakePrintInfoConfig)
    message(STATUS "==========================================================")
    message(STATUS "CMAKE_CROSSCOMPILING = ${CMAKE_CROSSCOMPILING}")
    message(STATUS "CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")
    message(STATUS "CMAKE_COLOR_MAKEFILE = ${CMAKE_COLOR_MAKEFILE}")
    message(STATUS "CMAKE_FIND_LIBRARY_PREFIXES = ${CMAKE_FIND_LIBRARY_PREFIXES}")
    message(STATUS "CMAKE_FIND_LIBRARY_SUFFIXES = ${CMAKE_FIND_LIBRARY_SUFFIXES}")
    message(STATUS "CMAKE_FIND_ROOT_PATH = ${CMAKE_FIND_ROOT_PATH}")
    message(STATUS "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = ${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE}")
    message(STATUS "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}")
    message(STATUS "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}")
    message(STATUS "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = ${CMAKE_FIND_ROOT_PATH_MODE_PROGRAM}")
    message(STATUS "CMAKE_SKIP_RPATH=${CMAKE_SKIP_RPATH}")
    message(STATUS "CMAKE_SKIP_BUILD_RPATH=${CMAKE_SKIP_BUILD_RPATH}")
    message(STATUS "CMAKE_SKIP_INSTALL_RPATH=${CMAKE_SKIP_INSTALL_RPATH}")
    message(STATUS "CMAKE_BUILD_WITH_INSTALL_RPATH=${CMAKE_BUILD_WITH_INSTALL_RPATH}")
    message(STATUS "CMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH}")
    message(STATUS "CMAKE_INSTALL_RPATH_USE_LINK_PATH=${CMAKE_INSTALL_RPATH_USE_LINK_PATH}")
endfunction()

function(XmakePrintInfoLang)
    message(STATUS "==========================================================")
    message(STATUS "CMAKE_IGNORE_PATH = ${CMAKE_IGNORE_PATH}")
    message(STATUS "CMAKE_INCLUDE_PATH = ${CMAKE_INCLUDE_PATH}")
    message(STATUS "CMAKE_SYSTEM_PREFIX_PATH=${CMAKE_SYSTEM_PREFIX_PATH}")
    message(STATUS "CMAKE_SYSTEM_INCLUDE_PATH = ${CMAKE_SYSTEM_INCLUDE_PATH}")
    message(STATUS "CMAKE_SYSTEM_LIBRARY_PATH = ${CMAKE_SYSTEM_LIBRARY_PATH}")
    message(STATUS "CMAKE_SYSTEM_PROGRAM_PATH = ${CMAKE_SYSTEM_PROGRAM_PATH}")
    message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}")
    message(STATUS "CMAKE_LINK_LIBRARY_SUFFIX = ${CMAKE_LINK_LIBRARY_SUFFIX}")
    message(STATUS "CMAKE_SHARED_LIBRARY_PREFIX = ${CMAKE_SHARED_LIBRARY_PREFIX}")
    message(STATUS "CMAKE_SHARED_LIBRARY_SUFFIX = ${CMAKE_SHARED_LIBRARY_SUFFIX}")
    message(STATUS "CMAKE_SHARED_MODULE_PREFIX = ${CMAKE_SHARED_MODULE_PREFIX}")
    message(STATUS "CMAKE_SHARED_MODULE_SUFFIX = ${CMAKE_SHARED_MODULE_SUFFIX}")
    message(STATUS "CMAKE_STATIC_LIBRARY_PREFIX = ${CMAKE_STATIC_LIBRARY_PREFIX}")
    message(STATUS "CMAKE_STATIC_LIBRARY_SUFFIX = ${CMAKE_STATIC_LIBRARY_SUFFIX}")
    message(STATUS "CMAKE_PLATFORM_IMPLICIT_LINK_LIBRARIES=${CMAKE_PLATFORM_IMPLICIT_LINK_LIBRARIES}")
    message(STATUS "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES=${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
    message(STATUS "CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
endfunction()

function(XmakePrintInfoCC)
    message(STATUS "==========================================================")
    message(STATUS "CMAKE_CL_64 = ${CMAKE_CL_64}")
    message(STATUS "CMAKE_COMPILER_2005 = ${CMAKE_COMPILER_2005}")
    message(STATUS "CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}")
    message(STATUS "CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}")
    message(STATUS "CMAKE_C_COMPILER_ID = ${CMAKE_C_COMPILER_ID}")
    message(STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
    message(STATUS "CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}")
    message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
    message(STATUS "CMAKE_C_COMPILE_FEATURES = ${CMAKE_C_COMPILE_FEATURES}")
    message(STATUS "CMAKE_C_STANDARD = ${CMAKE_C_STANDARD}")
    message(STATUS "CMAKE_CXX_COMPILE_FEATURES = ${CMAKE_CXX_COMPILE_FEATURES}")
    message(STATUS "CMAKE_CXX_STANDARD = ${CMAKE_CXX_STANDARD}")
    message(STATUS "CMAKE_C_IMPLICIT_LINK_LIBRARIES=${CMAKE_C_IMPLICIT_LINK_LIBRARIES}")
    message(STATUS "CMAKE_C_IMPLICIT_LINK_DIRECTORIES=${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
    message(STATUS "CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
    message(STATUS "CMAKE_CXX_IMPLICIT_LINK_LIBRARIES=${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
    message(STATUS "CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES=${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
    message(STATUS "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
endfunction()

#XmakePrintInfoCmake()
#XmakePrintInfoHost()
#XmakePrintInfoConfig()
#XmakePrintInfoLang()
#XmakePrintInfoCC()

function(XmakePrintInfoFindPackage pkgName)
    message(STATUS "==========================================================")
    message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
    message(STATUS "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
    find_package(${pkgName} 0.8.0)
if(false)
    # package configuration cmake file
    message(STATUS "${pkgName}_DIR=${${pkgName}_DIR}")
    message(STATUS "----------------------------------------------------------")
    message(STATUS "${pkgName}_VERSION_MAJOR=${${pkgName}_VERSION_MAJOR}")
    message(STATUS "${pkgName}_VERSION_MINOR=${${pkgName}_VERSION_MINOR}")
    message(STATUS "${pkgName}_VERSION_PATCH=${${pkgName}_VERSION_PATCH}")
    message(STATUS "${pkgName}_VERSION_TWEAK=${${pkgName}_VERSION_TWEAK}")
    message(STATUS "${pkgName}_VERSION_COUNT=${${pkgName}_VERSION_COUNT}")
    message(STATUS "----------------------------------------------------------")
    message(STATUS "PACKAGE_FIND_NAME=${PACKAGE_FIND_NAME}")
    message(STATUS "PACKAGE_FIND_VERSION=${PACKAGE_FIND_VERSION}")
    message(STATUS "PACKAGE_FIND_VERSION_MAJOR=${PACKAGE_FIND_VERSION_MAJOR}")
    message(STATUS "PACKAGE_FIND_VERSION_MINOR=${PACKAGE_FIND_VERSION_MINOR}")
    message(STATUS "PACKAGE_FIND_VERSION_PATCH=${PACKAGE_FIND_VERSION_PATCH}")
    message(STATUS "PACKAGE_FIND_VERSION_TWEAK=${PACKAGE_FIND_VERSION_TWEAK}")
    message(STATUS "PACKAGE_FIND_VERSION_COUNT=${PACKAGE_FIND_VERSION_COUNT}")
    message(STATUS "----------------------------------------------------------")
    message(STATUS "PACKAGE_VERSION=${PACKAGE_VERSION}")
    message(STATUS "PACKAGE_VERSION_EXACT=${PACKAGE_VERSION_EXACT}")
    message(STATUS "PACKAGE_VERSION_COMPATIBLE=${PACKAGE_VERSION_COMPATIBLE}")
    message(STATUS "PACKAGE_VERSION_UNSUITABLE=${PACKAGE_VERSION_UNSUITABLE}")
endif()
    message(STATUS "----------------------------------------------------------")
    message(STATUS "${pkgName}_FOUND=${${pkgName}_FOUND}")
    message(STATUS "${pkgName}_LIBRARIES=${${pkgName}_LIBRARIES}")
    message(STATUS "${pkgName}_INCLUDE_DIRS=${${pkgName}_INCLUDE_DIRS}")
    message(STATUS "${pkgName}_VERSION=${${pkgName}_VERSION}")
endfunction()
#XmakePrintInfoFindPackage(fooshared)

function(XmakePrintInfoPkgConfig pkgName pkgInstallDir)
    find_package(PkgConfig)
    if(PKG_CONFIG_FOUND)
        set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
        set(ENV{PKG_CONFIG_PATH} ${pkgInstallDir}/lib/pkgconfig)
        pkg_check_modules(${pkgName} ${pkgName}>=0.8.0 NO_CMAKE_PATH)
    endif()
if(false)
    message(STATUS "PKG_CONFIG_FOUND=${PKG_CONFIG_FOUND}")
    message(STATUS "PKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE}")
    message(STATUS "PKG_CONFIG_VERSION_STRING=${PKG_CONFIG_VERSION_STRING}")
    message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
    message(STATUS "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
    message(STATUS "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
    message(STATUS "PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}")
    message(STATUS "${pkgName}_PREFIX=${${pkgName}_PREFIX}")
    message(STATUS "${pkgName}_LDFLAGS_OTHER=${${pkgName}_LDFLAGS_OTHER}")
    message(STATUS "${pkgName}_CFLAGS_OTHER=${${pkgName}_CFLAGS_OTHER}")
endif()
    message(STATUS "==========================================================")
    message(STATUS "${pkgName}_FOUND=${${pkgName}_FOUND}")
    message(STATUS "${pkgName}_VERSION=${${pkgName}_VERSION}")
    message(STATUS "${pkgName}_LIBRARIES=${${pkgName}_LIBRARIES}")
    message(STATUS "${pkgName}_INCLUDE_DIRS=${${pkgName}_INCLUDE_DIRS}")
    message(STATUS "${pkgName}_LDFLAGS=${${pkgName}_LDFLAGS}")
    message(STATUS "${pkgName}_LIBRARY_DIRS=${${pkgName}_LIBRARY_DIRS}")
    message(STATUS "${pkgName}_CFLAGS=${${pkgName}_CFLAGS}")
    message(STATUS "${pkgName}_INCLUDEDIR=${${pkgName}_INCLUDEDIR}")
    message(STATUS "${pkgName}_LIBDIR=${${pkgName}_LIBDIR}")
endfunction()
#set(PKG_INSTALL_PREFIX /home/charlie/project/gkide/xmake/build/usr)
#XmakePrintInfoPkgConfig(libfoobar ${PKG_INSTALL_PREFIX})

function(XmakePrintConfigurationInfo)
    message(STATUS "Host OS: ${HOST_DIST_NAME} ${HOST_DIST_VERSION} ${ARCH_NAME}")

    if(git_REPO_PRINT_INFO)
        message(STATUS "Repo Hash: ${${XMAKE}_COMMIT_HASH}")
        message(STATUS "Repo Branch: ${${XMAKE}_BRANCH_NAME}")
        message(STATUS "Repo Describe: ${${XMAKE}_RECENT_TAG}")
        message(STATUS "Repo Commit Time: ${${XMAKE}_COMMIT_MDTZ}")
    endif()

    message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
    message(STATUS "Min Log Level: ${${XMAKE}_LOG_TYPE}(${${XMAKE}_LOG_LEVEL})")
    message(STATUS "Release Version: ${${XMAKE}_RELEASE_VERSION}")
    message(STATUS "Install Perfix: ${CMAKE_INSTALL_PREFIX}")

    if(${XMAKE}_ENABLE_CI) # Continuous Integration, Continuous Delivery
        message(STATUS "Enable CI/CD")
    endif()

    if(${XMAKE}_ENABLE_ASSERTION)
        message(STATUS "Enable assertion")
    endif()

    if(${XMAKE}_ENABLE_GCOV)
        message(STATUS "Enable code coverage measurements")
        if(NOT ${XMAKE}_DEBUG_BUILD)
            message(STATUS "    > SKIP code coverage for ${CMAKE_BUILD_TYPE} build")
            message(STATUS "    > The optimised build results maybe misleading")
        endif()
    endif()

    if(NOT WIN32 AND NOT ${XMAKE}_DISABLE_CCACHE AND CCACHE_PROG)
        message(STATUS "Enable compilation speedup through ccache")
    endif()

    # Extra Project Configuration by xmake user
    if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/ConfigPrint.cmake)
        include(${CMAKE_SOURCE_DIR}/cmake/ConfigPrint.cmake)
    endif()
endfunction()
