1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
# Plugin bootstrap module
include_guard(GLOBAL)
# Map fallback configurations for optimized build configurations
# gersemi: off
set(
CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO
RelWithDebInfo
Release
MinSizeRel
None
""
)
set(
CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL
MinSizeRel
Release
RelWithDebInfo
None
""
)
set(
CMAKE_MAP_IMPORTED_CONFIG_RELEASE
Release
RelWithDebInfo
MinSizeRel
None
""
)
# gersemi: on
# Prohibit in-source builds
if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
message(
FATAL_ERROR
"In-source builds 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()
# Add common module directories to default search path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
string(JSON _name GET ${buildspec} name)
string(JSON _website GET ${buildspec} website)
string(JSON _author GET ${buildspec} author)
string(JSON _email GET ${buildspec} email)
string(JSON _version GET ${buildspec} version)
string(JSON _bundleId GET ${buildspec} platformConfig macos bundleId)
set(PLUGIN_AUTHOR ${_author})
set(PLUGIN_WEBSITE ${_website})
set(PLUGIN_EMAIL ${_email})
set(PLUGIN_VERSION ${_version})
set(MACOS_BUNDLEID ${_bundleId})
string(REPLACE "." ";" _version_canonical "${_version}")
list(GET _version_canonical 0 PLUGIN_VERSION_MAJOR)
list(GET _version_canonical 1 PLUGIN_VERSION_MINOR)
list(GET _version_canonical 2 PLUGIN_VERSION_PATCH)
unset(_version_canonical)
# include(buildnumber)
include(osconfig)
# Allow selection of common build types via UI
if(NOT CMAKE_GENERATOR MATCHES "(Xcode|Visual Studio .+)")
if(NOT CMAKE_BUILD_TYPE)
set(
CMAKE_BUILD_TYPE
"RelWithDebInfo"
CACHE STRING
"OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]"
FORCE
)
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel
)
endif()
endif()
# Disable exports automatically going into the CMake package registry
set(CMAKE_EXPORT_PACKAGE_REGISTRY FALSE)
# Enable default inclusion of targets' source and binary directory
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
|