summaryrefslogtreecommitdiffstats
path: root/cmake/tests/features/CMakeLists.txt
blob: 8ff854ad5965cfae22d7c0f3ff07db1008638566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

cmake_minimum_required(VERSION 3.16)

project(FeaturesTest
    VERSION 1.0.0
    DESCRIPTION "QtFeature test"
    HOMEPAGE_URL "https://qt.io/"
    LANGUAGES CXX C
)

## Add some paths to check for cmake modules:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../;${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/extra-cmake-modules/find-modules;${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/kwin")

## Qt specific setup common for all modules:
include(QtSetup)

## Library to hold global features:
add_library(GlobalConfig INTERFACE)

qt_feature_module_begin(LIBRARY GlobalConfig
    PUBLIC_FILE src/corelib/global/qconfig.h
    PRIVATE_FILE src/corelib/global/qconfig_p.h
)
include("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
qt_feature_module_end(GlobalConfig)

assert(QT_FEATURE_top_a STREQUAL "ON")
assert(QT_FEATURE_top_b STREQUAL "OFF")
assert(QT_FEATURE_top_enabled STREQUAL "ON")
assert(QT_FEATURE_top_disabled STREQUAL "OFF")
assert(QT_FEATURE_top_disabled_enabled STREQUAL "OFF")
assert(QT_FEATURE_top_not_emitted STREQUAL "OFF")

## Enable feature summary at the end of the configure run:
include(FeatureSummary)

add_subdirectory(src)

## Delayed actions on some of the Qt targets:
include(QtPostProcess)

## Print a feature summary:
feature_summary(WHAT PACKAGES_FOUND PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)