summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
blob: e8af6c983809aedd28eb8dc8228e6edf3bce2e68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
cmake_minimum_required(VERSION 3.10)
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_compile_features(b PRIVATE ${QT_COMPILE_FEATURES})

# 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)