bootstrap.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # OBS CMake bootstrap module
  2. include_guard(GLOBAL)
  3. # Map fallback configurations for optimized build configurations
  4. # gersemi: off
  5. set(
  6. CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO
  7. RelWithDebInfo
  8. Release
  9. MinSizeRel
  10. None
  11. ""
  12. )
  13. set(
  14. CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL
  15. MinSizeRel
  16. Release
  17. RelWithDebInfo
  18. None
  19. ""
  20. )
  21. set(
  22. CMAKE_MAP_IMPORTED_CONFIG_RELEASE
  23. Release
  24. RelWithDebInfo
  25. MinSizeRel
  26. None
  27. ""
  28. )
  29. # gersemi: on
  30. # Prohibit in-source builds
  31. if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
  32. message(
  33. FATAL_ERROR
  34. "In-source builds of OBS are not supported. "
  35. "Specify a build directory via 'cmake -S <SOURCE DIRECTORY> -B <BUILD_DIRECTORY>' instead."
  36. )
  37. file(REMOVE_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt" "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles")
  38. endif()
  39. # Set default global project variables
  40. set(OBS_COMPANY_NAME "OBS Project")
  41. set(OBS_PRODUCT_NAME "OBS Studio")
  42. set(OBS_WEBSITE "https://www.obsproject.com")
  43. set(OBS_COMMENTS "Free and open source software for video recording and live streaming")
  44. set(OBS_LEGAL_COPYRIGHT "(C) Lain Bailey")
  45. set(OBS_CMAKE_VERSION 3.0.0)
  46. # Configure default version strings
  47. set(_obs_default_version "0" "0" "1")
  48. set(_obs_release_candidate 0)
  49. set(_obs_beta 0)
  50. # Add common module directories to default search path
  51. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/finders")
  52. include(policies NO_POLICY_SCOPE)
  53. include(versionconfig)
  54. include(buildnumber)
  55. include(osconfig)
  56. # Allow selection of common build types via UI
  57. if(NOT CMAKE_GENERATOR MATCHES "(Xcode|Visual Studio .+)")
  58. if(NOT CMAKE_BUILD_TYPE)
  59. set(
  60. CMAKE_BUILD_TYPE
  61. "RelWithDebInfo"
  62. CACHE STRING
  63. "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]"
  64. FORCE
  65. )
  66. set_property(
  67. CACHE CMAKE_BUILD_TYPE
  68. PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel
  69. )
  70. endif()
  71. endif()
  72. # Enable default inclusion of targets' source and binary directory
  73. set(CMAKE_INCLUDE_CURRENT_DIR TRUE)