IF (FMOD_LIBRARIES AND FMOD_INCLUDE_DIR)
    SET(FMOD_FIND_QUIETLY TRUE) # Already in cache, be silent
ENDIF (FMOD_LIBRARIES AND FMOD_INCLUDE_DIR)

IF (WIN32) #Windows
    MESSAGE(STATUS "Looking for FMOD")
    SET(FMOD_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/fmod/inc/)
    SET(FMOD_LIB_DIR ${CMAKE_SOURCE_DIR}/dependencies/fmod/lib_win32/) 
    SET(FMOD_LIBRARIES debug FMODCollision_d  FMODDynamics_d FMODSoftBody_d  LinearMath_d   optimized FMODCollision  FMODDynamics  FMODSoftBody  LinearMath   )
ELSE (WIN32) #Unix
    MESSAGE(STATUS "Looking for FMOD")
    SET(FMOD_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dependencies/fmod/inc/)
    SET(FMOD_LIB_DIR ${CMAKE_SOURCE_DIR}/dependencies/fmod/lib/) 
    SET(FMOD_LIBRARIES fmodex64 CACHE STRING "")
ENDIF (WIN32)

SET(FMOD_INCLUDE_DIR ${FMOD_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(FMOD_LIB_DIR ${FMOD_LIB_DIR} CACHE PATH "" FORCE)
SET(FMOD_LIBRARIES ${FMOD_LIBRARIES} CACHE STRING "" FORCE)

MARK_AS_ADVANCED(FMOD_INCLUDE_DIR)
MARK_AS_ADVANCED(FMOD_LIB_DIR)
MARK_AS_ADVANCED(FMOD_LIBRARIES)

IF (FMOD_INCLUDE_DIR AND FMOD_LIBRARIES)
    SET(FMOD_FOUND TRUE)
ENDIF (FMOD_INCLUDE_DIR AND FMOD_LIBRARIES)

IF (FMOD_FOUND)
    IF (NOT FMOD_FIND_QUIETLY)
        MESSAGE(STATUS "  libraries : ${FMOD_LIBRARIES} from ${FMOD_LIB_DIR}")
        MESSAGE(STATUS "  includes  : ${FMOD_INCLUDE_DIR}")
    ENDIF (NOT FMOD_FIND_QUIETLY)
ELSE (FMOD_FOUND)
    IF (FMOD_FIND_REQUIRED)
        MESSAGE(FATAL_ERROR "Could not find FMOD")
    ENDIF (FMOD_FIND_REQUIRED)
ENDIF (FMOD_FOUND)
