Merge branch 'release-3.31'
[kiteware-cmake.git] / Tests / QtAutogen / ObjectLibrary / CMakeLists.txt
blob88d0998974aec8777e9e56a401ab48bbbc20ce47
1 cmake_minimum_required(VERSION 3.16)
2 project(ObjectLibrary)
3 include("../AutogenCoreTest.cmake")
5 set(CMAKE_INCLUDE_CURRENT_DIR ON)
6 set(CMAKE_AUTOMOC ON)
8 # Object library a defined in a subdirectory
9 add_subdirectory(a)
11 # Object library b defined locally
12 include_directories(b)
13 add_library(b OBJECT b/classb.cpp)
14 target_link_libraries(b PRIVATE ${QT_LIBRARIES})
16 # Executable with OBJECT library generator expressions
17 add_executable(someProgram main.cpp $<TARGET_OBJECTS:a> $<TARGET_OBJECTS:b>)
18 target_link_libraries(someProgram ${QT_LIBRARIES})
20 # Executable without its own AUTOMOC.
21 add_executable(someProgram2 main.cpp)
22 target_link_libraries(someProgram2 PRIVATE a b ${QT_LIBRARIES})
23 set_property(TARGET someProgram2 PROPERTY AUTOMOC OFF)