blob: f095867469b90cbd8011a9b83ddb53afa84371c3 [file] [log] [blame]
Chris Kay74665262021-03-09 18:57:01 +00001#
2# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7cmake_minimum_required(VERSION 3.20)
8
9#
Chris Kay794a13a2021-06-25 15:10:00 +010010# Ensure our own CMake modules can be loaded.
11#
12
13list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules")
14
Chris Kayfd5256a2021-07-23 14:14:24 +010015include(ArmConfigOption)
16
17#
18# Set up the configuration types for both single and multi-configuration
19# generators.
20#
21
22set(config-types "Debug" "RelWithDebInfo" "MinSizeRel" "Release")
23set(default-config "MinSizeRel")
24
25get_property(multi-config GLOBAL PROPERTY "GENERATOR_IS_MULTI_CONFIG")
26
27if(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}")
37else()
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)
44endif()
45
Chris Kay794a13a2021-06-25 15:10:00 +010046#
Chris Kay74665262021-03-09 18:57:01 +000047# 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
70project(TFA VERSION 2.5 LANGUAGES C ASM)