if(EXISTS "${CMAKE_SOURCE_DIR}/${SFMLBOOTSTRAP_EXTERNAL_DIR}/tgui" AND IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${SFMLBOOTSTRAP_EXTERNAL_DIR}/tgui")
        set(TGUI_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PROJ_BUILD_DIR} -DSFML_ROOT=${PROJ_BUILD_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DTGUI_SHARED_LIBS=FALSE -DTGUI_USE_STATIC_STD_LIBS=TRUE -DINSTALL_MISC_DIR=${PROJ_BUILD_DIR})
	ExternalProject_Add(tgui
          PREFIX "${PROJ_BUILD_DIR}/${SFMLBOOTSTRAP_EXTERNAL_DIR}/tgui"
          SOURCE_DIR "${CMAKE_SOURCE_DIR}/${SFMLBOOTSTRAP_EXTERNAL_DIR}/tgui"
          INSTALL_DIR "${PROJ_BUILD_DIR}"
          CMAKE_ARGS "${TGUI_CMAKE_ARGS}"
	)
        ExternalProject_Add_Step(tgui forcebuild COMMAND ${CMAKE_COMMAND} -E echo "Force build of tgui" DEPENDEES configure DEPENDERS build ALWAYS 1)
	add_dependencies(tgui ${PROJ_DEPS})
        include_directories(${CMAKE_SOURCE_DIR}/${SFMLBOOTSTRAP_EXTERNAL_DIR}/tgui/include)
        set(TGUI_LIBS debug ${PROJ_BUILD_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}tgui-s-d${CMAKE_STATIC_LIBRARY_SUFFIX} optimized ${PROJ_BUILD_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}tgui-s${CMAKE_STATIC_LIBRARY_SUFFIX})
        list(APPEND PROJ_LIBS ${TGUI_LIBS})
        list(APPEND PROJ_DEPS tgui)
endif()
