diff options
| author | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
| commit | f44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (patch) | |
| tree | d8de60fc7e17edeb6f0921726c038ee54b281445 /cmake/scripts/common/GeneratorSetup.cmake | |
| parent | ae08c8b7221bc965ac40d70e53fc8fcddb050c46 (diff) | |
| download | kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.gz kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.bz2 kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.zip | |
sync with upstream
Diffstat (limited to 'cmake/scripts/common/GeneratorSetup.cmake')
| -rw-r--r-- | cmake/scripts/common/GeneratorSetup.cmake | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/cmake/scripts/common/GeneratorSetup.cmake b/cmake/scripts/common/GeneratorSetup.cmake new file mode 100644 index 0000000..304b504 --- /dev/null +++ b/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 | ||
| 7 | if(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})") | ||
| 13 | else() | ||
| 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})") | ||
| 24 | endif() | ||
| 25 | |||
| 26 | # Print CMake version | ||
| 27 | message(STATUS "CMake Version: ${CMAKE_VERSION}") | ||
| 28 | |||
| 29 | # Deal with CMake special cases | ||
| 30 | if(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)") | ||
| 33 | endif() | ||
| 34 | |||
| 35 | # Darwin needs CMake 3.4 | ||
| 36 | if(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.") | ||
| 39 | endif() | ||
| 40 | |||
| 41 | # Windows needs CMake 3.6 (VS_STARTUP_PROJECT) | ||
| 42 | if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.6) | ||
| 43 | message(FATAL_ERROR "Build on Windows needs CMake 3.6 or later") | ||
| 44 | endif() | ||
| 45 | |||
| 46 | # Ninja needs CMake 3.2 due to ExternalProject BUILD_BYPRODUCTS usage | ||
| 47 | if(CMAKE_GENERATOR STREQUAL Ninja AND CMAKE_VERSION VERSION_LESS 3.2) | ||
| 48 | message(FATAL_ERROR "Generator: Ninja requires CMake 3.2 or later") | ||
| 49 | endif() | ||
