qt5base-lts/tests/auto/cmake/test_interface/CMakeLists.txt
Lucie Gérard fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00

35 lines
1.0 KiB
CMake

# 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(test_interface)
find_package(Qt6Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(test_interface_exe WIN32 main.cpp mainwindow.cpp)
# No need to specify include directories, compile definitions, the PIC flag, or to
# link explicitly to Qt::WinMain.
target_link_libraries(test_interface_exe Qt::Widgets)
# Fix try_compile to inherit the parent configuration.
set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}")
# Can't use source file based try_compile, because it doesn't handle object libraries
# referenced in generator expressions properly.
try_compile(_TRY_COMPILE_RES
"${CMAKE_CURRENT_BINARY_DIR}/widget_test"
"${CMAKE_CURRENT_SOURCE_DIR}/widget_test"
widget_test
OUTPUT_VARIABLE TC_OV
)
if (NOT _TRY_COMPILE_RES)
message(SEND_ERROR "The use of try_compile with Qt::Widgets failed. The output was :\n${TC_OV}")
endif()