summaryrefslogtreecommitdiffstats
path: root/project/cmake/scripts/common/generatorsetup.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/scripts/common/generatorsetup.cmake')
-rw-r--r--project/cmake/scripts/common/generatorsetup.cmake24
1 files changed, 24 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..75083ca
--- /dev/null
+++ b/project/cmake/scripts/common/generatorsetup.cmake
@@ -0,0 +1,24 @@
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()