###############################################################################
# Copyright (c) 2012 Evgeny Proydakov <lord.tiran@gmail.com>
###############################################################################

MACRO(I_ADD_EXECUTABLE args)

MESSAGE(STATUS "create ${ARGV0}")
SET(EXECUTABLE_NAME ${ARGV0})
ADD_EXECUTABLE(${EXECUTABLE_NAME} ${ARGN})
SOURCE_GROUP(source FILES ${ARGN})
SET_PROPERTY(TARGET ${EXECUTABLE_NAME} PROPERTY FOLDER ${GLOBAL_PROJECT_FOLDER})

ENDMACRO(I_ADD_EXECUTABLE)

###############################################################################

MACRO(I_ADD_DIRECTX_EXECUTABLE args)

MESSAGE(STATUS "create ${ARGV0}")
SET(EXECUTABLE_NAME ${ARGV0})
ADD_EXECUTABLE(${EXECUTABLE_NAME} WIN32 ${ARGN})
SOURCE_GROUP(source FILES ${ARGN})
SET_PROPERTY(TARGET ${EXECUTABLE_NAME} PROPERTY FOLDER ${GLOBAL_PROJECT_FOLDER})

ENDMACRO(I_ADD_DIRECTX_EXECUTABLE)

###############################################################################

MACRO(I_ADD_LIBRARY args)

SET(LIBRARY_NAME ${ARGV0})
ADD_LIBRARY(${LIBRARY_NAME} STATIC ${ARGN})
SOURCE_GROUP(source FILES ${ARGN})
SET_PROPERTY(TARGET ${LIBRARY_NAME} PROPERTY FOLDER ${GLOBAL_PROJECT_FOLDER})

ENDMACRO(I_ADD_LIBRARY)

###############################################################################

MACRO(I_ADD_SHARED_LIBRARY args)

SET(LIBRARY_NAME ${ARGV0})
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${ARGN})
SOURCE_GROUP(source FILES ${ARGN})
SET_PROPERTY(TARGET ${LIBRARY_NAME} PROPERTY FOLDER ${GLOBAL_PROJECT_FOLDER})

ENDMACRO(I_ADD_SHARED_LIBRARY)

###############################################################################

MACRO(I_ADD_LUA_LIBRARY args)

SET(LIBRARY_NAME ${ARGV0})
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${ARGN})
SOURCE_GROUP(source FILES ${ARGN})
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES DEFINE_SYMBOL LUA_EXPORT)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES FOLDER ${GLOBAL_PROJECT_FOLDER})

ENDMACRO(I_ADD_LUA_LIBRARY)

###############################################################################

MACRO(I_BUILD_REPORT)

SET(BUILD_INFO_BAR "====================================================================================")
SET(NOOP_STRING "")

set(RUNTIME_MODE "shared")
if (STATIC_LINK)
    set(RUNTIME_MODE "static")
endif()

MESSAGE(STATUS ${BUILD_INFO_BAR})
MESSAGE(STATUS "Summary of the build:")
MESSAGE(STATUS ${BUILD_INFO_BAR})
MESSAGE(STATUS "CMAKE:        ${CMAKE_COMMAND} [${CMAKE_VERSION}]")
MESSAGE(STATUS "GENERATOR:    ${CMAKE_GENERATOR}")
if(BUILD_TOOL_VERSION)
MESSAGE(STATUS "BUILD_TOOL:   ${CMAKE_BUILD_TOOL} [${BUILD_TOOL_VERSION}]")
else()
MESSAGE(STATUS "BUILD_TOOL:   ${CMAKE_BUILD_TOOL}")
endif()
MESSAGE(STATUS "C_COMPILER:   ${CMAKE_C_COMPILER} [${CMAKE_C_COMPILER_ID}-${CMAKE_C_COMPILER_VERSION}]")
MESSAGE(STATUS "CXX_COMPILER: ${CMAKE_CXX_COMPILER} [${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}]")
MESSAGE(STATUS "LINKER:       ${CMAKE_LINKER}")
MESSAGE(STATUS "RUNTIME MODE: ${RUNTIME_MODE}")
MESSAGE(STATUS "CXX_RUNTIME:  ${CXX_RUNTIME_LIBRARY}")
MESSAGE(STATUS "")
MESSAGE(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "")
MESSAGE(STATUS "CMAKE_C_FLAGS:   ${CMAKE_C_FLAGS}")
MESSAGE(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG:   ${CMAKE_CXX_FLAGS_DEBUG}")
MESSAGE(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
MESSAGE(STATUS "")
MESSAGE(STATUS "CMAKE_EXE_LINKER_FLAGS:    ${CMAKE_EXE_LINKER_FLAGS}")
MESSAGE(STATUS "CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
MESSAGE(STATUS ${BUILD_INFO_BAR})
MESSAGE(STATUS ${NOOP_STRING})

ENDMACRO(I_BUILD_REPORT)
