FIND_PATH(SDL2_MIXER_INCLUDE_DIR SDL2/SDL_mixer.h
  HINTS ${LIBS}
  PATH_SUFFIXES include i686-w64-mingw32/include x86_64-w64-mingw32/include
  PATHS ~/Library/Frameworks /Library/Frameworks /usr/local/include /usr/include /opt
)

GET_FILENAME_COMPONENT(SDL2_MIXER_DIR ${SDL2_MIXER_INCLUDE_DIR} DIRECTORY)

IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
  SET(SDL2_ARCH_64 TRUE)
  SET(SDL2_PROCESSOR_ARCH "x64")
  FIND_LIBRARY(SDL2_MIXER_LIBRARY_TEMP
    NAMES SDL2_MIXER
    HINTS ${LIBS}/SDL2_mixer
    PATH_SUFFIXES lib64 lib lib/x64 x86_64-w64-mingw32/lib
    PATHS /sw /opt/local /usr/local /opt/csw /opt
  )
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
  SET(SDL2_ARCH_64 FALSE)
  SET(SDL2_PROCESSOR_ARCH "x86")
  FIND_LIBRARY(SDL2_MIXER_LIBRARY_TEMP
    NAMES SDL2_MIXER
    HINTS ${LIBS}/SDL2_mixer
    PATH_SUFFIXES lib lib/x86 i686-w64-mingw32/lib
    PATHS /sw /opt/local /usr/local /opt/csw /opt
  )
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)

IF(SDL2_MIXER_LIBRARY_TEMP)
  SET(SDL2_MIXER_LIBRARY ${SDL2_MIXER_LIBRARY_TEMP} CACHE STRING "Where the SDL2_mixer Library can be found")
  SET(SDL2_MIXER_LIBRARY_TEMP ${SDL2_MIXER_LIBRARY_TEMP} CACHE INTERNAL "")
ELSE(SDL2_MIXER_LIBRARY_TEMP)
  MESSAGE(FATAL_ERROR "Could not find the libs for SDL2_mixer. Make sure the library folders have the correct names. SDL2_MIXER_LIBRARY_TEMP was not set.")
ENDIF(SDL2_MIXER_LIBRARY_TEMP)

INCLUDE(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_MIXER REQUIRED_VARS SDL2_MIXER_LIBRARY SDL2_MIXER_INCLUDE_DIR)
