2012-11-05 14:18:14 +00:00
|
|
|
|
2021-09-22 13:11:47 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2012-11-05 14:18:14 +00:00
|
|
|
|
|
|
|
project(test_interface)
|
|
|
|
|
2020-07-14 08:38:51 +00:00
|
|
|
find_package(Qt6Widgets)
|
2012-11-05 14:18:14 +00:00
|
|
|
|
|
|
|
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
|
2020-07-14 08:38:51 +00:00
|
|
|
# link explicitly to Qt::WinMain.
|
|
|
|
target_link_libraries(test_interface_exe Qt::Widgets)
|
2012-11-05 14:18:14 +00:00
|
|
|
|
2018-10-17 20:03:28 +00:00
|
|
|
# Fix try_compile to inherit the parent configuration.
|
|
|
|
set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}")
|
|
|
|
|
2021-03-15 16:03:38 +00:00
|
|
|
# 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
|
2012-11-05 14:18:14 +00:00
|
|
|
OUTPUT_VARIABLE TC_OV
|
|
|
|
)
|
|
|
|
|
|
|
|
if (NOT _TRY_COMPILE_RES)
|
2020-07-14 08:38:51 +00:00
|
|
|
message(SEND_ERROR "The use of try_compile with Qt::Widgets failed. The output was :\n${TC_OV}")
|
2012-11-05 14:18:14 +00:00
|
|
|
endif()
|