+endif(GETTEXT_FOUND AND ENABLE_GETTEXT)
+
+# user visible option to enable/disable sound
+OPTION(ENABLE_SOUND "Enable sound" ON)
+
+# this is only set to 1 if sound is enabled _and_ available
+set(USE_SOUND 0)
+set(SOUND_PROBLEM 0)
+
+if(ENABLE_SOUND AND BUILD_CLIENT)
+ # Sound libraries
+ find_package(OpenAL)
+ find_package(Vorbis)
+ if(NOT OPENAL_FOUND)
+ message(STATUS "Sound enabled, but OpenAL not found!")
+ set(SOUND_PROBLEM 1)
+ MARK_AS_ADVANCED(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
+ endif()
+ if(NOT VORBIS_FOUND)
+ message(STATUS "Sound enabled, but Vorbis libraries not found!")
+ set(SOUND_PROBLEM 1)
+ MARK_AS_ADVANCED(CLEAR OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
+ endif()
+ if(OPENAL_FOUND AND VORBIS_FOUND)
+ set(USE_SOUND 1)
+ message(STATUS "Sound enabled")
+ endif()
+endif(ENABLE_SOUND AND BUILD_CLIENT)
+
+if(SOUND_PROBLEM)
+ message(FATAL_ERROR "Sound enabled, but cannot be used.\n"
+ "To continue, either fill in the required paths or disable sound. (-DENABLE_SOUND=0)")
+endif()
+if(USE_SOUND)
+ set(sound_SRCS sound_openal.cpp)
+ set(SOUND_INCLUDE_DIRS
+ ${OPENAL_INCLUDE_DIR}
+ ${VORBIS_INCLUDE_DIR}
+ ${OGG_INCLUDE_DIR}
+ )
+ set(SOUND_LIBRARIES
+ ${OPENAL_LIBRARY}
+ ${VORBIS_LIBRARIES}
+ )
+endif()