Files
CMake/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
Craig Scott a742088472 Tests: Add support for testing Qt6
The minimum CMake version for Qt6 is 3.16, so all the calls to
cmake_minimum_required() are updated here to enforce that
minimum. This will avoid any CMake version-related warnings
from Qt.

Avoid hard-coding Qt5 where the tests could now be using
Qt5 or Qt6.

Fixes: #22188
2021-10-04 22:10:57 +11:00

24 lines
742 B
CMake

cmake_minimum_required(VERSION 3.16)
project(ObjectLibrary)
include("../AutogenCoreTest.cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
# Object library a defined in a subdirectory
add_subdirectory(a)
# Object library b defined locally
include_directories(b)
add_library(b OBJECT b/classb.cpp)
target_link_libraries(b PRIVATE ${QT_LIBRARIES})
# Executable with OBJECT library generator expressions
add_executable(someProgram main.cpp $<TARGET_OBJECTS:a> $<TARGET_OBJECTS:b>)
target_link_libraries(someProgram ${QT_LIBRARIES})
# Executable without its own AUTOMOC.
add_executable(someProgram2 main.cpp)
target_link_libraries(someProgram2 PRIVATE a b ${QT_LIBRARIES})
set_property(TARGET someProgram2 PROPERTY AUTOMOC OFF)