|
@@ -1,21 +1,40 @@
|
|
|
# OBS CMake bootstrap module
|
|
|
|
|
|
+include_guard(GLOBAL)
|
|
|
+
|
|
|
# Enable automatic PUSH and POP of policies to parent scope
|
|
|
if(POLICY CMP0011)
|
|
|
cmake_policy(SET CMP0011 NEW)
|
|
|
endif()
|
|
|
|
|
|
+# Enable distinction between Clang and AppleClang
|
|
|
+if(POLICY CMP0025)
|
|
|
+ cmake_policy(SET CMP0025 NEW)
|
|
|
+endif()
|
|
|
+
|
|
|
+# Enable strict checking of "break()" usage
|
|
|
+if(POLICY CMP0055)
|
|
|
+ cmake_policy(SET CMP0055 NEW)
|
|
|
+endif()
|
|
|
+
|
|
|
+# Honor visibility presets for all target types (executable, shared, module, static)
|
|
|
+if(POLICY CMP0063)
|
|
|
+ cmake_policy(SET CMP0063 NEW)
|
|
|
+endif()
|
|
|
+
|
|
|
+# Disable export function calls to populate package registry by default
|
|
|
+if(POLICY CMP0090)
|
|
|
+ cmake_policy(SET CMP0090 NEW)
|
|
|
+endif()
|
|
|
# Prohibit in-source builds
|
|
|
-if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
|
|
- message(
|
|
|
- FATAL_ERROR
|
|
|
- "OBS: In-source builds of OBS are not supported. Specify a build directory via 'cmake -S <SOURCE DIRECTORY> -B <BUILD_DIRECTORY>' instead."
|
|
|
- )
|
|
|
+if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
+ message(FATAL_ERROR "In-source builds of OBS are not supported. "
|
|
|
+ "Specify a build directory via 'cmake -S <SOURCE DIRECTORY> -B <BUILD_DIRECTORY>' instead.")
|
|
|
+ file(REMOVE_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt" "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles")
|
|
|
endif()
|
|
|
-file(REMOVE_RECURSE "${CMAKE_SOURCE_DIR}/CMakeCache.txt" "${CMAKE_SOURCE_DIR}/CMakeFiles")
|
|
|
|
|
|
# Use folders for source file organization with IDE generators (Visual Studio/Xcode)
|
|
|
-set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
+set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
|
|
|
|
|
|
# Set default global project variables
|
|
|
set(OBS_COMPANY_NAME "OBS Project")
|
|
@@ -23,9 +42,9 @@ set(OBS_PRODUCT_NAME "OBS Studio")
|
|
|
set(OBS_WEBSITE "https://www.obsproject.com")
|
|
|
set(OBS_COMMENTS "Free and open source software for video recording and live streaming")
|
|
|
set(OBS_LEGAL_COPYRIGHT "(C) Lain Bailey")
|
|
|
+set(OBS_CMAKE_VERSION 3.0.0)
|
|
|
|
|
|
# Configure default version strings
|
|
|
-message(DEBUG "Setting default project version variables...")
|
|
|
set(_obs_default_version "0" "0" "1")
|
|
|
set(_obs_release_candidate "0" "0" "0" "0")
|
|
|
set(_obs_beta "0" "0" "0" "0")
|
|
@@ -38,7 +57,7 @@ include(buildnumber)
|
|
|
include(osconfig)
|
|
|
|
|
|
# Allow selection of common build types via UI
|
|
|
-if(NOT CMAKE_BUILD_TYPE)
|
|
|
+if(NOT CMAKE_GENERATOR MATCHES "(Xcode|Visual Studio .+)")
|
|
|
set(CMAKE_BUILD_TYPE
|
|
|
"RelWithDebInfo"
|
|
|
CACHE STRING "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE)
|