0da123d67b
Needed for subsequent change that will check and error out if the version is lower than 3.16. We do that to ensure all policies introduced by CMake up to version 3.16 have their behavior set to NEW. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: Ieaf82c10987dd797d86a3fd4a986a67e72de486a Reviewed-by: Kai Koehne <kai.koehne@qt.io>
32 lines
935 B
CMake
32 lines
935 B
CMake
|
|
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()
|