MACRO(FINDMYSQL)#A macro interface for finding a dependency
	include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindMySQL.cmake)
	IF(NOT MYSQL_FOUND)
		IF(WIN32)
			set(MYSQL_LIBRARIES "${PROGRAMFILESX86}/MySQL/MySQL Server 5.1/lib/opt/libmysql.lib")
			set(MYSQL_INCLUDE_DIR "${PROGRAMFILESX86}/MySQL/MySQL Server 5.1/include")
			STANDARDNOTFOUNDMESSAGE("MySQL" "${MYSQL_LIBRARIES}" "${MYSQL_INCLUDE_DIR}" "Assuming 5.1 install\n" "USEMYSQL")
		ELSE(WIN32)
			set(MYSQL_LIBRARIES "/usr/lib/libmysqlclient.so")
			set(MYSQL_INCLUDE_DIR "/usr/include/mysql")
			STANDARDNOTFOUNDMESSAGE("MySQL" "${MYSQL_LIBRARIES}" "${MYSQL_INCLUDE_DIR}" "" "USEMYSQL")
		ENDIF(WIN32)
	ENDIF(NOT MYSQL_FOUND)
ENDMACRO(FINDMYSQL)

MACRO(FINDPOSTGRE)#A macro interface for finding a dependency
	IF (WIN32)
		set(CUSTOMPROGRAMFILES "D:/Program Files")
	ELSE(WIN32)
		set(CUSTOMPROGRAMFILES "")
	ENDIF(WIN32)
	include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindPostgreSQL.cmake)
	IF(NOT POSTGRESQL_FOUND)
		IF(WIN32)
			set(POSTGRESQL_LIBRARIES "${PROGRAMFILESX86}/PostgreSQL/8.4/lib/libpq.lib")
			set(POSTGRESQL_INCLUDE_DIR "${PROGRAMFILESX86}/PostgreSQL/8.4/include")
			STANDARDNOTFOUNDMESSAGE("PostgreSQL" "${POSTGRESQL_LIBRARIES}" "${POSTGRESQL_INCLUDE_DIR}" "Assuming 8.4 install\n" "USEPOSTGRESQL")
		ELSE(WIN32)
			set(POSTGRESQL_LIBRARIES "/usr/lib/libpq.so")
			set(POSTGRESQL_INCLUDE_DIR "/usr/include/postgresql")
			STANDARDNOTFOUNDMESSAGE("PostgreSQL" "${POSTGRESQL_LIBRARIES}" "${POSTGRESQL_INCLUDE_DIR}" "" "USEPOSTGRESQL")
		ENDIF(WIN32)
	ENDIF(NOT POSTGRESQL_FOUND)
ENDMACRO(FINDPOSTGRE)

MACRO(FINDPORTAUDIO)#A macro interface for finding a dependency
	IF(WIN32)
		set(PORTAUDIO_INCLUDE_DIR ${portaudio_SOURCE_DIR}/pa_common)
		set(PORTAUDIO_LIBRARIES LibPortAudioV18_1)
		set(PORTAUDIO_FOUND TRUE)
	ELSE(WIN32)
		include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindPortAudio.cmake)
	ENDIF(WIN32)
	IF(NOT PORTAUDIO_FOUND)
		IF(NOT WIN32)
			set(PORTAUDIO_INCLUDE_DIR "/usr/include")
			set(PORTAUDIO_LIBRARIES "/usr/lib/libportaudio.so")
		ENDIF(NOT WIN32)
		STANDARDNOTFOUNDMESSAGE("PortAudio" "${PORTAUDIO_LIBRARIES}" "${PORTAUDIO_INCLUDE_DIR}" "" "USEPORTAUDIO")
	ENDIF(NOT PORTAUDIO_FOUND)
ENDMACRO(FINDPORTAUDIO)

MACRO(FINDSPEEX)#A macro interface for finding a dependency
	IF(WIN32)
		set(SPEEX_INCLUDE_DIRS ${speex_SOURCE_DIR}/include)
		set(SPEEX_LIBRARIES LibSpeex)
		set(SPEEX_FOUND TRUE)
	ELSE(WIN32)
		include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindSpeex.cmake)
		FINDSPEEXDSP()
	ENDIF(WIN32)
	IF(NOT SPEEX_FOUND)
		IF(NOT WIN32)
			set(SPEEX_INCLUDE_DIRS "/usr/include")
			set(SPEEX_LIBRARIES "/usr/lib/libspeex.so")
		ENDIF(NOT WIN32)
		STANDARDNOTFOUNDMESSAGE("Speex" "${SPEEX_LIBRARIES}" "${SPEEX_INCLUDE_DIRS}" "" "USESPEEX")
	ELSE(NOT SPEEX_FOUND)
		set(SPEEX_INCLUDE_DIRS ${SPEEX_INCLUDE_DIRS} ${SPEEXDSP_INCLUDE_DIRS})
		set(SPEEX_LIBRARIES    ${SPEEX_LIBRARIES} ${SPEEXDSP_LIBRARIES})
	ENDIF(NOT SPEEX_FOUND)
ENDMACRO(FINDSPEEX)

MACRO(FINDBOOST)#A macro interface for finding a dependency
	include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindBoost.cmake)
	IF(NOT Boost_FOUND)
		IF(WIN32)
			set(Boost_INCLUDE_DIRS "${PROGRAMFILESX86}/boost/boost_1_35")
			set(Boost_LIBRARIES "")
			STANDARDNOTFOUNDMESSAGE("BOOST" "${Boost_LIBRARIES}" "${Boost_INCLUDE_DIRS}" "Assuming 1.35 install" "USEBOOST")
		ELSE(WIN32)
			set(Boost_INCLUDE_DIRS "/usr/include")
			set(Boost_LIBRARIES "")
			STANDARDNOTFOUNDMESSAGE("BOOST" "${Boost_LIBRARIES}" "${Boost_INCLUDE_DIRS}" "" "USEBOOST")
		ENDIF(WIN32)
	ENDIF(NOT Boost_FOUND)
ENDMACRO(FINDBOOST)

MACRO(FINDSPEEXDSP)#A macro interface for finding a dependency
	include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindSpeexDSP.cmake)
	IF(NOT SPEEXDSP_FOUND)
		set(SPEEXDSP_INCLUDE_DIRS "/usr/include")
		set(SPEEXDSP_LIBRARIES "/usr/lib/libspeexdsp.so")
		STANDARDNOTFOUNDMESSAGE("SpeexDSP" "${SPEEXDSP_LIBRARIES}" "${SPEEXDSP_INCLUDE_DIRS}" "" "USESPEEX")
	ENDIF(NOT SPEEXDSP_FOUND)
ENDMACRO(FINDSPEEXDSP)

MACRO(FINDDSOUND)
	IF(WIN32 AND NOT UNIX)
		IF("$ENV{DXSDK_DIR}" STREQUAL "")
			set (DSOUND_INCLUDE_DIR "C:/Program Files/Microsoft DirectX SDK (November 2008)/")
			set (DSOUND_LIBRARIES "C:/Program Files/Microsoft DirectX SDK (November 2008)/Dsound.lib" "C:/Program Files/Microsoft DirectX SDK (November 2008)/Dxguid.lib" "C:/Program Files/Microsoft DirectX SDK (November 2008)/Dxerr.lib")
			message(STATUS "*You need to install the Direct X 9 SDK")
			STANDARDNOTFOUNDMESSAGE("Direct Sound SDK" "${DSOUND_LIBRARIES}" "${DSOUND_INCLUDE_DIR}" "" "USEDSOUND")
		ELSE("$ENV{DXSDK_DIR}" STREQUAL "")
			set (DSOUND_INCLUDE_DIR $ENV{DXSDK_DIR}include)
			set (DSOUND_LIBRARIES $ENV{DXSDK_DIR}lib/x86/Dsound.lib $ENV{DXSDK_DIR}lib/x86/Dxguid.lib $ENV{DXSDK_DIR}lib/x86/Dxerr.lib)
		ENDIF("$ENV{DXSDK_DIR}" STREQUAL "")
	ENDIF(WIN32 AND NOT UNIX)
ENDMACRO(FINDDSOUND)

MACRO(FINDD3D)
	IF(WIN32 AND NOT UNIX)
		IF("$ENV{DXSDK_DIR}" STREQUAL "")
			set (D3D_INCLUDE_DIR "C:/Program Files/Microsoft DirectX SDK (November 2008)/")
			set (D3D_LIBRARIES "C:/Program Files/Microsoft DirectX SDK (November 2008)/d3d9.lib" "C:/Program Files/Microsoft DirectX SDK (November 2008)/d3dx9.lib")
			message(STATUS "*You need to install the Direct X 9 SDK")
			STANDARDNOTFOUNDMESSAGE("Direct X 9 SDK" "${D3D_LIBRARIES}" "${D3D_INCLUDE_DIR}" "" "USEDX3D9")
		ELSE("$ENV{DXSDK_DIR}" STREQUAL "")
			set (D3D_INCLUDE_DIR $ENV{DXSDK_DIR}include)
			set (D3D_LIBRARIES "$ENV{DXSDK_DIR}lib/x86/d3d9.lib" "$ENV{DXSDK_DIR}lib/x86/d3dx9.lib")
		ENDIF("$ENV{DXSDK_DIR}" STREQUAL "")
	ENDIF(WIN32 AND NOT UNIX)
ENDMACRO(FINDD3D)

MACRO(FINDSCALEGFX)
	IF(WIN32 AND NOT UNIX)
		set (SCALEGFX_INCLUDE_DIR "$ENV{GFXSDK}/Include" "$ENV{GFXSDK}/Src/GRenderer" "$ENV{GFXSDK}/Src/GKernel" "$ENV{GFXSDK}/Src/GFxXML")
		set (SCALEGFX_LIBRARIES optimized "$ENV{GFXSDK}/Lib/Win32/Msvc80/Release/libgrenderer_d3d9.lib" optimized "$ENV{GFXSDK}/Lib/Win32/Msvc80/Release/libgfx.lib" optimized "$ENV{GFXSDK}/3rdParty/jpeg-6b/Lib/Win32/Msvc80/Release/libjpeg.lib" optimized "$ENV{GFXSDK}/3rdParty/zlib-1.2.3/Lib/Win32/Msvc80/Release/zlib.lib")
		set (SCALEGFX_DEBUG_LIBRARIES debug "$ENV{GFXSDK}/Lib/Win32/Msvc80/Debug/libgrenderer_d3d9.lib" debug "$ENV{GFXSDK}/Lib/Win32/Msvc80/Debug/libgfx.lib" debug "$ENV{GFXSDK}/3rdParty/jpeg-6b/Lib/Win32/Msvc80/Debug/libjpeg.lib" debug "$ENV{GFXSDK}/3rdParty/zlib-1.2.3/Lib/Win32/Msvc80/Debug/zlib.lib")
	ELSE(WIN32 AND NOT UNIX)
		message(STATUS "Scaleform is not supported for the linux build, please do not enable it\n")
	ENDIF(WIN32 AND NOT UNIX)
	
ENDMACRO(FINDSCALEGFX)

MACRO(FINDFMODEX)#A macro interface for finding a dependency
	include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindFMODEx.cmake)
	IF(NOT FMODEX_FOUND)
		IF(WIN32)
			set(FMODEX_LIBRARY "${PROGRAMFILESX86}/FMOD SoundSystem/FMOD Programmers API Win32/api/lib/${WINLIBNAME}.${WINLIBEXT}")
			set(FMODEX_INCLUDE_DIR "${PROGRAMFILESX86}/FMOD SoundSystem/FMOD Programmers API Win32/api/inc")
		ELSE(WIN32)
			set(FMODEX_LIBRARY "/usr/local/lib/libfmodex-4.28.08.so")
			set(FMODEX_INCLUDE_DIR "/usr/local/include/fmodex")
		ENDIF(WIN32)
	STANDARDNOTFOUNDMESSAGE("FMOD EX" "${FMODEX_LIBRARY}" "${FMODEX_INCLUDE_DIR}" "" "USEFMOD")
	ENDIF(NOT FMODEX_FOUND)
ENDMACRO(FINDFMODEX)

MACRO(FINDIRRLICHT)
	IF(WIN32 AND NOT UNIX)
		message(STATUS "You are building with the Irrlicht option enabled,\n if irrlicht include location is not C:/irrlicht-1.6/include\n change IRRLICHT_INCLUDE_DIR with the GUI or -D command line option.\n NOTE: YOU MUST USE VERSION 1.6 for this demo.")
		set(IRRLICHT_INCLUDE_DIR "C:/irrlicht-1.6/include" CACHE PATH "The Irrlicht unzip location")
	ELSE(WIN32 AND NOT UNIX)
		include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindIrrlicht.cmake)
		IF(NOT IRRLICHT_FOUND)
			set(IRRLICHT_INCLUDE_DIR "/usr/include/irrlicht")
			set(IRRLICHT_LIBRARIES "/usr/local/lib/libIrrlicht.so")
			STANDARDNOTFOUNDMESSAGE("Irrlicht" "${IRRLICHT_LIBRARIES}" "${IRRLICHT_INCLUDE_DIR}" "" "USEIRRLICHT")
		ENDIF(NOT IRRLICHT_FOUND)
	ENDIF(WIN32 AND NOT UNIX)
ENDMACRO(FINDIRRLICHT)

MACRO(FINDIRRKLANG)
	IF(WIN32 AND NOT UNIX)
		#currently not needed a space is here for future use
	ELSE(WIN32 AND NOT UNIX)
		include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindIrrKlang.cmake)
		IF(NOT IRRKLANG_FOUND)
			set(IRRKLANG_INCLUDE_DIR "/usr/include/irrklang")
			set(IRRKLANG_LIBRARIES "/usr/local/lib/libIrrKlang.so")
			STANDARDNOTFOUNDMESSAGE("irrKlang" "${IRRKLANG_LIBRARIES}" "${IRRKLANG_INCLUDE_DIR}" "" "USEIRRKLANG")
		ENDIF(NOT IRRKLANG_FOUND)
	ENDIF(WIN32 AND NOT UNIX)
ENDMACRO(FINDIRRKLANG)

MACRO(FINDOGRE3D)#A macro interface for finding a dependency
	include(${RakNet_SOURCE_DIR}/CmakeIncludes/Ogre3D/FindOGRE.cmake)
	IF(NOT OGRE_FOUND)
		IF(WIN32)
			FILE(GLOB OGRE_LIBRARIES "C:/OgreSDK/lib/*.lib")
			set(OGRE_INCLUDE_DIR "C:/OgreSDK/include")
			#set(OGRE_LIB_DIR "C:/OgreSDK/lib/")
		ELSE(WIN32)
			set(OGRE_LIBRARIES "/usr/lib/libOgreMain.so")
			set(OGRE_INCLUDE_DIR "/usr/include/OGRE/")
		ENDIF(WIN32)
	STANDARDNOTFOUNDMESSAGE("Ogre 3d" "${OGRE_LIBRARIES}" "${OGRE_INCLUDE_DIR}" "" "USEOGRE3D")
	ENDIF(NOT OGRE_FOUND)
ENDMACRO(FINDOGRE3D)

MACRO(FINDOIS)#A macro interface for finding a dependency
	include(${RakNet_SOURCE_DIR}/CmakeIncludes/Ogre3D/FindOIS.cmake)
	IF(NOT OIS_FOUND)
		IF(WIN32)
			set(OIS_LIBRARIES "")
			set(OIS_INCLUDE_DIR "")
		ELSE(WIN32)
			set(OIS_LIBRARIES "/usr/lib/libOIS.so")
			set(OIS_INCLUDE_DIR "/usr/include/OIS")
		ENDIF(WIN32)
	STANDARDNOTFOUNDMESSAGE("OIS" "${OIS_LIBRARIES}" "${OIS_INCLUDE_DIR}" "" "USEIOS")
	ENDIF(NOT OIS_FOUND)
ENDMACRO(FINDOIS)

MACRO(STANDARDNOTFOUNDMESSAGE NAME PLIBRARIES PINCLUDES EXTRA_INFORMATION DISABLENAME)#If the libraries are not found, what to display
	IF (WIN32)
		message(STATUS "${NAME} was not found, paths were set to:\nLibrary: ${PLIBRARIES}\nInclude: ${PINCLUDES}\n${EXTRA_INFORMATION}Some projects will not compile unless installed to those locations.\nAs an alternative you can install the libraries and rerun cmake and see if the autosearch finds them.\nYou may disable any or all dependencies by setting the proper variable.\nThis dependency can be disabled with -D${DISABLENAME}=FALSE.\nAll dependencies can be disabled by the command line option -DDISABLEDEPENDENCIES=TRUE or setting it in the GUI.")
	ELSE(WIN32)
		message(STATUS "${NAME} was not found, paths were set to:\nLibrary: ${PLIBRARIES}\nInclude: ${PINCLUDES}\n${EXTRA_INFORMATION}\nSome projects will not compile unless installed to those locations. As an alternative you can install the libraries and rerun cmake and see if the autosearch finds them. You may disable any or all dependencies by setting the proper variable. This dependency can be disabled with -D${DISABLENAME}=FALSE. All dependencies can be disabled by the command line option -DDISABLEDEPENDENCIES=TRUE or setting it in the GUI.")
	ENDIF(WIN32)
ENDMACRO(STANDARDNOTFOUNDMESSAGE)
