Chris Kay | 7466526 | 2021-03-09 18:57:01 +0000 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
| 7 | cmake_minimum_required(VERSION 3.20) |
| 8 | |
| 9 | # |
Chris Kay | 794a13a | 2021-06-25 15:10:00 +0100 | [diff] [blame] | 10 | # Ensure our own CMake modules can be loaded. |
| 11 | # |
| 12 | |
| 13 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules") |
| 14 | |
Chris Kay | fd5256a | 2021-07-23 14:14:24 +0100 | [diff] [blame^] | 15 | include(ArmConfigOption) |
| 16 | |
| 17 | # |
| 18 | # Set up the configuration types for both single and multi-configuration |
| 19 | # generators. |
| 20 | # |
| 21 | |
| 22 | set(config-types "Debug" "RelWithDebInfo" "MinSizeRel" "Release") |
| 23 | set(default-config "MinSizeRel") |
| 24 | |
| 25 | get_property(multi-config GLOBAL PROPERTY "GENERATOR_IS_MULTI_CONFIG") |
| 26 | |
| 27 | if(multi-config) |
| 28 | arm_config_option( |
| 29 | NAME CMAKE_CONFIGURATION_TYPES HIDDEN |
| 30 | HELP "Multi-generator configuration types." |
| 31 | DEFAULT ${config-types}) |
| 32 | |
| 33 | arm_config_option( |
| 34 | NAME CMAKE_DEFAULT_BUILD_TYPE HIDDEN |
| 35 | HELP "Default multi-generator configuration type." |
| 36 | DEFAULT "${default-config}") |
| 37 | else() |
| 38 | arm_config_option( |
| 39 | NAME CMAKE_BUILD_TYPE |
| 40 | HELP "Build type." |
| 41 | STRINGS ${config-types} |
| 42 | DEFAULT ${default-config} |
| 43 | FORCE NOT CMAKE_BUILD_TYPE) |
| 44 | endif() |
| 45 | |
Chris Kay | 794a13a | 2021-06-25 15:10:00 +0100 | [diff] [blame] | 46 | # |
Chris Kay | 7466526 | 2021-03-09 18:57:01 +0000 | [diff] [blame] | 47 | # We're done with very early setup, so we can now create the project. This will |
| 48 | # do some of the automatic compiler detection, which we need for setting up |
| 49 | # further configuration options. |
| 50 | # |
| 51 | # Note that this creates the following version variables: |
| 52 | # |
| 53 | # - `TFA_VERSION` |
| 54 | # - `TFA_VERSION_MAJOR` |
| 55 | # - `TFA_VERSION_MINOR` |
| 56 | # - `TFA_VERSION_PATCH` |
| 57 | # - `TFA_VERSION_TWEAK` |
| 58 | # |
| 59 | # Also, these directory variables: |
| 60 | # |
| 61 | # - `TFA_SOURCE_DIR` |
| 62 | # - `TFA_BINARY_DIR` |
| 63 | # |
| 64 | # Don't swap `C` and `ASM`. Per the CMake documentation: |
| 65 | # |
| 66 | # > If enabling `ASM`, list it last so that CMake can check whether compilers |
| 67 | # > for other languages like `C` work for assembly too. |
| 68 | # |
| 69 | |
| 70 | project(TFA VERSION 2.5 LANGUAGES C ASM) |