summaryrefslogtreecommitdiffstats
path: root/project/cmake/scripts/common/GeneratorSetup.cmake
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2016-11-24 21:27:41 +0100
committermanuel <manuel@mausz.at>2016-11-24 21:27:41 +0100
commit8cdf8dec703d882b46ca50a769fabb95ffc48e2c (patch)
treef7fe8233508f79d3dc94f8f445ce6342e7dfbdbb /project/cmake/scripts/common/GeneratorSetup.cmake
parent5823b05feb29a59510c32a9c28ca18b50b9b6399 (diff)
downloadkodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.gz
kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.bz2
kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.zip
sync with upstream
Diffstat (limited to 'project/cmake/scripts/common/GeneratorSetup.cmake')
-rw-r--r--project/cmake/scripts/common/GeneratorSetup.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/project/cmake/scripts/common/GeneratorSetup.cmake b/project/cmake/scripts/common/GeneratorSetup.cmake
new file mode 100644
index 0000000..304b504
--- /dev/null
+++ b/project/cmake/scripts/common/GeneratorSetup.cmake
@@ -0,0 +1,49 @@
1# Configure single-/multiconfiguration generators and variables
2#
3# CORE_BUILD_CONFIG that is set to
4# - CMAKE_BUILD_TYPE for single configuration generators such as make, nmake
5# - a variable that expands on build time to the current configuration for
6# multi configuration generators such as VS or Xcode
7if(CMAKE_CONFIGURATION_TYPES)
8 if(CMAKE_BUILD_TYPE)
9 message(FATAL_ERROR "CMAKE_BUILD_TYPE must not be defined for multi-configuration generators")
10 endif()
11 set(CORE_BUILD_CONFIG ${CMAKE_CFG_INTDIR})
12 message(STATUS "Generator: Multi-configuration (${CMAKE_GENERATOR})")
13else()
14 if(CMAKE_BUILD_TYPE)
15 set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
16 CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE)
17 else()
18 # Set default
19 set(CMAKE_BUILD_TYPE Release
20 CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE)
21 endif()
22 set(CORE_BUILD_CONFIG ${CMAKE_BUILD_TYPE})
23 message(STATUS "Generator: Single-configuration: ${CMAKE_BUILD_TYPE} (${CMAKE_GENERATOR})")
24endif()
25
26# Print CMake version
27message(STATUS "CMake Version: ${CMAKE_VERSION}")
28
29# Deal with CMake special cases
30if(CMAKE_VERSION VERSION_EQUAL 3.5.1)
31 message(WARNING "CMake 3.5.1 introduced a crash during configuration. "
32 "Please consider upgrading to 3.5.2 (cmake.org/Bug/view.php?id=16044)")
33endif()
34
35# Darwin needs CMake 3.4
36if(APPLE AND CMAKE_VERSION VERSION_LESS 3.4)
37 message(WARNING "Build on Darwin requires CMake 3.4 or later (tdb library support) "
38 "or the usage of the patched version in depends.")
39endif()
40
41# Windows needs CMake 3.6 (VS_STARTUP_PROJECT)
42if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.6)
43 message(FATAL_ERROR "Build on Windows needs CMake 3.6 or later")
44endif()
45
46# Ninja needs CMake 3.2 due to ExternalProject BUILD_BYPRODUCTS usage
47if(CMAKE_GENERATOR STREQUAL Ninja AND CMAKE_VERSION VERSION_LESS 3.2)
48 message(FATAL_ERROR "Generator: Ninja requires CMake 3.2 or later")
49endif()