defaults.cmake 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # OBS CMake macOS defaults module
  2. include_guard(GLOBAL)
  3. # Set empty codesigning team if not specified as cache variable
  4. if(NOT OBS_CODESIGN_TEAM)
  5. set(OBS_CODESIGN_TEAM "" CACHE STRING "OBS code signing team for macOS" FORCE)
  6. # Set ad-hoc codesigning identity if not specified as cache variable
  7. if(NOT OBS_CODESIGN_IDENTITY)
  8. set(OBS_CODESIGN_IDENTITY "-" CACHE STRING "OBS code signing identity for macOS" FORCE)
  9. endif()
  10. endif()
  11. include(xcode)
  12. include(buildspec)
  13. # SWIG hard codes the directory to its library directory at compile time. As obs-deps need to be relocatable, we need to
  14. # force SWIG to look for its files in a directory relative to the PREFIX_PATH. The best way to ensure this is to set the
  15. # SWIG_LIB environment variable.
  16. foreach(path IN LISTS CMAKE_PREFIX_PATH)
  17. if(NOT DEFINED ENV{SWIG_LIB} AND EXISTS "${path}/bin/swig")
  18. set(ENV{SWIG_LIB} "${path}/share/swig/CURRENT")
  19. break()
  20. endif()
  21. endforeach()
  22. # Enable find_package targets to become globally available targets
  23. set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
  24. # Enable RPATH support for generated binaries
  25. set(CMAKE_MACOSX_RPATH TRUE)
  26. # Use RPATHs from build tree _in_ the build tree
  27. set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  28. # Do not add default linker search paths to RPATH
  29. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
  30. # Use common bundle-relative RPATH for installed targets
  31. set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
  32. # Ignore any dependent packages installed via Homebrew
  33. list(APPEND CMAKE_IGNORE_PREFIX_PATH "/opt/homebrew" "/usr/local")
  34. # Used for library exports only (obs-frontend-api)
  35. set(OBS_LIBRARY_DESTINATION "lib")
  36. set(OBS_INCLUDE_DESTINATION "include/obs")
  37. set(OBS_CMAKE_DESTINATION "lib/cmake")
  38. configure_file(
  39. "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/resources/package.applescript"
  40. "${CMAKE_CURRENT_BINARY_DIR}/package.applescript"
  41. @ONLY
  42. )