summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_global_promotion/subdir_with_global_qt/CMakeLists.txt
blob: a8808a8c832006ce271c1250aa81de0a49ed8830 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
message(STATUS "Entered subdir_with_global_qt subdirectory")

set(file_path "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp")
file(GENERATE OUTPUT "${file_path}" CONTENT "int foo() { return 42; }")
add_library(lib_global_qt STATIC "${file_path}")

# These Qt targets will be available in all scopes of the project.
# The previous local targets are simply shadowed.
set(QT_PROMOTE_TO_GLOBAL_TARGETS ON)
find_package(Qt6 REQUIRED COMPONENTS Gui)

target_link_libraries(lib_global_qt PRIVATE Qt6::Gui)

message(STATUS "Exiting subdir_with_global_qt subdirectory")