mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-05 16:55:25 +08:00
qt 6.5.1 original
This commit is contained in:
52
tests/auto/cmake/test_testlib_no_link_widgets/CMakeLists.txt
Normal file
52
tests/auto/cmake/test_testlib_no_link_widgets/CMakeLists.txt
Normal file
@ -0,0 +1,52 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(no_link_widgets)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
|
||||
endif()
|
||||
|
||||
find_package(Qt6Widgets REQUIRED HINTS ${Qt6Tests_PREFIX_PATH})
|
||||
find_package(Qt6Test REQUIRED HINTS ${Qt6Tests_PREFIX_PATH})
|
||||
|
||||
include_directories(
|
||||
${Qt6Widgets_INCLUDE_DIRS}
|
||||
${Qt6Test_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
${Qt6Widgets_DEFINITIONS}
|
||||
${Qt6Test_DEFINITIONS}
|
||||
)
|
||||
|
||||
set(main_file "main.cpp")
|
||||
set(moc_file "${CMAKE_CURRENT_BINARY_DIR}/main.moc")
|
||||
|
||||
qt_generate_moc("${main_file}" "${moc_file}")
|
||||
|
||||
# The core_test is expected to fail to build because
|
||||
# QT_WIDGETS_LIB is defined, which affects the contents of
|
||||
# QtTest and the definition of QTEST_MAIN.
|
||||
# If running this test manually (ctest -V -R no_link_widgets from
|
||||
# the tests/auto/cmake/build directory), the core_test is
|
||||
# expected to fail to link because of missing symbols from Qt GUI
|
||||
# and Qt Widgets.
|
||||
# The widgets_test is expected to build successfully (though it may
|
||||
# be necessary to comment out the core_test and re-run cmake)
|
||||
add_executable(core_test "${main_file}" "${moc_file}")
|
||||
target_link_libraries(core_test
|
||||
${Qt6Core_LIBRARIES}
|
||||
${Qt6Test_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(widgets_test "${main_file}" "${moc_file}")
|
||||
target_link_libraries(widgets_test
|
||||
${Qt6Widgets_LIBRARIES}
|
||||
${Qt6Test_LIBRARIES}
|
||||
)
|
Reference in New Issue
Block a user