bootstrap.cmake 2.1 KB

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