CMakeLists.txt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # This file is part of Desktop App Toolkit,
  2. # a set of libraries for developing nice desktop applications.
  3. #
  4. # For license and copyright information please follow this link:
  5. # https://github.com/desktop-app/legal/blob/master/LEGAL
  6. add_library(external_openal INTERFACE IMPORTED GLOBAL)
  7. add_library(desktop-app::external_openal ALIAS external_openal)
  8. if (DESKTOP_APP_USE_PACKAGED)
  9. find_package(OpenAL)
  10. if (OPENAL_FOUND)
  11. target_include_directories(external_openal SYSTEM INTERFACE ${OPENAL_INCLUDE_DIR})
  12. target_link_libraries(external_openal INTERFACE ${OPENAL_LIBRARY})
  13. return()
  14. endif()
  15. find_package(OpenAL REQUIRED CONFIG)
  16. target_link_libraries(external_openal INTERFACE OpenAL::OpenAL)
  17. return()
  18. elseif (WIN32)
  19. target_include_directories(external_openal SYSTEM
  20. INTERFACE
  21. ${libs_loc}/openal-soft/include
  22. ${libs_loc}/openal-soft/include/AL
  23. )
  24. target_link_libraries(external_openal
  25. INTERFACE
  26. ${libs_loc}/openal-soft/build/$<IF:$<CONFIG:Debug>,Debug,RelWithDebInfo>/OpenAL32.lib
  27. )
  28. elseif (APPLE)
  29. target_include_directories(external_openal SYSTEM
  30. INTERFACE
  31. ${libs_loc}/local/include
  32. ${libs_loc}/local/include/AL
  33. )
  34. target_link_libraries(external_openal
  35. INTERFACE
  36. ${libs_loc}/local/lib/libopenal.a
  37. )
  38. else()
  39. target_include_directories(external_openal SYSTEM
  40. INTERFACE
  41. /usr/local/include/AL
  42. )
  43. target_link_static_libraries(external_openal
  44. INTERFACE
  45. openal
  46. )
  47. endif()
  48. target_compile_definitions(external_openal
  49. INTERFACE
  50. AL_LIBTYPE_STATIC
  51. )