bootstrap.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # OBS CMake bootstrap module
  2. # Enable automatic PUSH and POP of policies to parent scope
  3. if(POLICY CMP0011)
  4. cmake_policy(SET CMP0011 NEW)
  5. endif()
  6. # Prohibit in-source builds
  7. if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
  8. message(
  9. FATAL_ERROR
  10. "OBS: In-source builds of OBS are not supported. Specify a build directory via 'cmake -S <SOURCE DIRECTORY> -B <BUILD_DIRECTORY>' instead."
  11. )
  12. endif()
  13. file(REMOVE_RECURSE "${CMAKE_SOURCE_DIR}/CMakeCache.txt" "${CMAKE_SOURCE_DIR}/CMakeFiles")
  14. # Use folders for source file organization with IDE generators (Visual Studio/Xcode)
  15. set_property(GLOBAL PROPERTY USE_FOLDERS ON)
  16. # Set default global project variables
  17. set(OBS_COMPANY_NAME "OBS Project")
  18. set(OBS_PRODUCT_NAME "OBS Studio")
  19. set(OBS_WEBSITE "https://www.obsproject.com")
  20. set(OBS_COMMENTS "Free and open source software for video recording and live streaming")
  21. set(OBS_LEGAL_COPYRIGHT "(C) Lain Bailey")
  22. # Configure default version strings
  23. message(DEBUG "Setting default project version variables...")
  24. set(_obs_default_version "0" "0" "1")
  25. set(_obs_release_candidate "0" "0" "0" "0")
  26. set(_obs_beta "0" "0" "0" "0")
  27. # Add common module directories to default search path
  28. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/finders")
  29. include(versionconfig)
  30. include(buildnumber)
  31. include(osconfig)
  32. # Allow selection of common build types via UI
  33. if(NOT CMAKE_BUILD_TYPE)
  34. set(CMAKE_BUILD_TYPE
  35. "RelWithDebInfo"
  36. CACHE STRING "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE)
  37. set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel)
  38. endif()
  39. # Disable exports automatically going into the CMake package registry
  40. set(CMAKE_EXPORT_PACKAGE_REGISTRY FALSE)
  41. # Enable default inclusion of targets' source and binary directory
  42. set(CMAKE_INCLUDE_CURRENT_DIR TRUE)