set(PROJECT_NAME AntTweakBar)

################################################################################
# Source groups
################################################################################
set(no_group_source_files
    "FontSmall.pgm"
    "res/cur00000.cur"
    "res/cur00001.cur"
    "res/cur00002.cur"
    "res/cur00003.cur"
    "res/cur00004.cur"
    "res/cur00005.cur"
    "res/cur00006.cur"
    "res/cur00007.cur"
    "res/cur00008.cur"
    "res/cur00009.cur"
    "res/cur00010.cur"
    "res/cur00011.cur"
    "res/cur00012.cur"
    "res/cur00013.cur"
    "res/FontChars.txt"
    "res/FontFixed1.pgm"
    "res/FontLargeAA.pgm"
    "res/FontNormal.pgm"
#    "TwDirect3D11.hlsl"
)
source_group("" FILES ${no_group_source_files})

set(Headers
    "../include/AntTweakBar.h"
    "AntPerfTimer.h"
    "LoadOGL.h"
    "LoadOGLCore.h"
    "MiniGLFW.h"
    "MiniGLUT.h"
    "MiniSDL12.h"
    "MiniSDL13.h"
    "MiniSFML16.h"
    "res/TwXCursors.h"
    "resource.h"
    "TwBar.h"
    "TwColors.h"
    "TwDirect3D10.h"
    "TwDirect3D11.h"
    "TwDirect3D9.h"
    "TwFonts.h"
    "TwGraph.h"
    "TwMgr.h"
    "TwOpenGL.h"
    "TwOpenGLCore.h"
    "TwPrecomp.h"
)
source_group("Headers" FILES ${Headers})

set(Sources
    "LoadOGL.cpp"
    "LoadOGLCore.cpp"
    "TwBar.cpp"
    "TwColors.cpp"
    "TwDirect3D10.cpp"
    "TwDirect3D11.cpp"
    "TwDirect3D9.cpp"
    "TwEventGLFW.c"
    "TwEventGLUT.c"
    "TwEventSDL.c"
    "TwEventSDL12.c"
    "TwEventSDL13.c"
    "TwEventSFML.cpp"
    "TwEventWin.c"
    "TwFonts.cpp"
    "TwMgr.cpp"
    "TwOpenGL.cpp"
    "TwOpenGLCore.cpp"
    "TwPrecomp.cpp"
)
source_group("Sources" FILES ${Sources})

set(ALL_FILES
    ${no_group_source_files}
    ${Headers}
    ${Sources}
)

################################################################################
# Target
################################################################################
add_library(${PROJECT_NAME} SHARED ${ALL_FILES})

target_precompile_headers(${PROJECT_NAME} PRIVATE
    "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/TwPrecomp.h>"
)

use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}")
set(ROOT_NAMESPACE AntTweakBar)

################################################################################
# Target name
################################################################################
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        TARGET_NAME_DEBUG   "AntTweakBar"
        TARGET_NAME_RELEASE "AntTweakBar"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        TARGET_NAME_DEBUG   "AntTweakBar64"
        TARGET_NAME_RELEASE "AntTweakBar64"
    )
endif()
################################################################################
# Output directory
################################################################################
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        OUTPUT_DIRECTORY_DEBUG   "${CMAKE_CURRENT_SOURCE_DIR}/../lib/debug"
        OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../lib"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        OUTPUT_DIRECTORY_DEBUG   "${CMAKE_CURRENT_SOURCE_DIR}/../lib/debug"
        OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../lib"
    )
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        ARCHIVE_OUTPUT_DIRECTORY_DEBUG   "${OUTPUT_DIRECTORY}"
        ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        ARCHIVE_OUTPUT_DIRECTORY_DEBUG   "${OUTPUT_DIRECTORY}"
        ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}"
    )
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        ARCHIVE_OUTPUT_NAME_DEBUG   "${TARGET_NAME}"
        ARCHIVE_OUTPUT_NAME_RELEASE "${TARGET_NAME}"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        ARCHIVE_OUTPUT_NAME_DEBUG   "${TARGET_NAME}"
        ARCHIVE_OUTPUT_NAME_RELEASE "${TARGET_NAME}"
    )
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        PDB_OUTPUT_DIRECTORY         "${OUTPUT_DIRECTORY}"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        PDB_OUTPUT_DIRECTORY         "${OUTPUT_DIRECTORY}"
    )
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    set_target_properties(${PROJECT_NAME} PROPERTIES
        INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
    )
endif()
################################################################################
# MSVC runtime library
################################################################################
get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
        $<$<CONFIG:Debug>:
            MultiThreadedDebug
        >
        $<$<CONFIG:Release>:
            MultiThreaded
        >
        $<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
        $<$<CONFIG:Debug>:
            MultiThreadedDebug
        >
        $<$<CONFIG:Release>:
            MultiThreaded
        >
        $<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}>
    )
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR})

################################################################################
# Include directories
################################################################################
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    target_include_directories(${PROJECT_NAME} PUBLIC
        "${CMAKE_CURRENT_SOURCE_DIR}/../include"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    target_include_directories(${PROJECT_NAME} PUBLIC
        "${CMAKE_CURRENT_SOURCE_DIR}/../include"
    )
endif()

################################################################################
# Compile definitions
################################################################################
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    target_compile_definitions(${PROJECT_NAME} PRIVATE
        "$<$<CONFIG:Debug>:"
            "_DEBUG"
        ">"
        "$<$<CONFIG:Release>:"
            "NDEBUG"
        ">"
        "WIN32;"
        "_WINDOWS;"
        "_USRDLL;"
        "TW_EXPORTS;"
        "_MBCS"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    target_compile_definitions(${PROJECT_NAME} PRIVATE
        "$<$<CONFIG:Debug>:"
            "_DEBUG"
        ">"
        "$<$<CONFIG:Release>:"
            "NDEBUG"
        ">"
        "WIN64;"
        "_WIN64;"
        "_WINDOWS;"
        "_USRDLL;"
        "TW_EXPORTS;"
        "_MBCS"
    )
endif()

################################################################################
# Compile and link options
################################################################################
if(MSVC)
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        target_compile_options(${PROJECT_NAME} PRIVATE
            $<$<CONFIG:Debug>:
                /Od;
                /RTC1;
                /ZI
            >
            $<$<CONFIG:Release>:
                /Ox;
                /Ob1;
                /Oi;
                /GF;
                /Gy;
                ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
                /Ot;
                /Zc:forScope
            >
            /W4;
            ${DEFAULT_CXX_EXCEPTION_HANDLING}
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        target_compile_options(${PROJECT_NAME} PRIVATE
            $<$<CONFIG:Debug>:
                /Od;
                /RTC1;
                /Zi
            >
            $<$<CONFIG:Release>:
                /Ox;
                /Ob1;
                /Oi;
                /GF;
                /Gy;
                ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
                /Ot;
                /Zc:forScope
            >
            /W4;
            ${DEFAULT_CXX_EXCEPTION_HANDLING}
        )
    endif()
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwEventGLFW.c ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwEventGLUT.c ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwEventSDL.c ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwEventSDL12.c ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwEventSDL13.c ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwEventSFML.cpp ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwEventWin.c ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        string(CONCAT FILE_CL_OPTIONS
            "/Y-"
        )
    endif()
    source_file_compile_options(TwOpenGLCore.cpp ${FILE_CL_OPTIONS})
    if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
        target_link_options(${PROJECT_NAME} PRIVATE
            $<$<CONFIG:Debug>:
                /DEBUG;
                /INCREMENTAL
            >
            $<$<CONFIG:Release>:
                /INCREMENTAL:NO
            >
            /NOLOGO;
            /DYNAMICBASE:NO
        )
    elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
        target_link_options(${PROJECT_NAME} PRIVATE
            $<$<CONFIG:Debug>:
                /DEBUG;
                /INCREMENTAL
            >
            $<$<CONFIG:Release>:
                /INCREMENTAL:NO
            >
            /NOLOGO;
            /MACHINE:X64;
            /DYNAMICBASE:NO
        )
    endif()
endif()

################################################################################
# Pre build events
################################################################################
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    add_custom_command_if(
        TARGET ${PROJECT_NAME}
        PRE_BUILD
        COMMANDS
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextPS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T vs_4_0_level_9_1 /E TextVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T ps_4_0_level_9_1 /E TextPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextPS.h TwDirect3D11.hlsl
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    add_custom_command_if(
        TARGET ${PROJECT_NAME}
        PRE_BUILD
        COMMANDS
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T ps_4_0_level_9_1 /E LineRectPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E TextVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T vs_4_0_level_9_1 /E TextCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
        COMMAND   $<CONFIG:Debug> fxc /Od /Zi /T ps_4_0_level_9_1 /E TextPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextPS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T vs_4_0_level_9_1 /E LineRectVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc/T vs_4_0_level_9_1 /E LineRectCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectCstColorVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T ps_4_0_level_9_1 /E LineRectPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_LineRectPS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T vs_4_0_level_9_1 /E TextVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T vs_4_0_level_9_1 /E TextCstColorVS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextCstColorVS.h TwDirect3D11.hlsl
        COMMAND $<CONFIG:Release> fxc /T ps_4_0_level_9_1 /E TextPS /Fh ${CMAKE_CURRENT_BINARY_DIR}\\${CMAKE_CFG_INTDIR}\\TwDirect3D11_TextPS.h TwDirect3D11.hlsl
    )
endif()

################################################################################
# Post build events
################################################################################
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
    add_custom_command_if(
        TARGET ${PROJECT_NAME}
        POST_BUILD
        COMMANDS
        COMMAND   $<CONFIG:Debug> mkdir "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
        COMMAND   $<CONFIG:Debug> xcopy /y /f "$<SHELL_PATH:$<TARGET_FILE:${PROJECT_NAME}>>" "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
        COMMAND $<CONFIG:Release> mkdir "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
        COMMAND $<CONFIG:Release> xcopy /y /f "$<SHELL_PATH:$<TARGET_FILE:${PROJECT_NAME}>>" "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
    )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
    add_custom_command_if(
        TARGET ${PROJECT_NAME}
        POST_BUILD
        COMMANDS
        COMMAND   $<CONFIG:Debug> mkdir "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
        COMMAND   $<CONFIG:Debug> xcopy /y /f "$<SHELL_PATH:$<TARGET_FILE:${PROJECT_NAME}>>" "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
        COMMAND $<CONFIG:Release> mkdir "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
        COMMAND $<CONFIG:Release> xcopy /y /f "$<SHELL_PATH:$<TARGET_FILE:${PROJECT_NAME}>>" "$<SHELL_PATH:${CMAKE_SOURCE_DIR}/>${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>"
    )
endif()

